News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Bug repport

Started by nidud, February 03, 2016, 01:51:30 AM

Previous topic - Next topic

dedndave

no - you have to use a 16-bit linker for OMF format object files
LINK16.EXE

for win32, the format is COFF

TouEnMasm

There is no need of frame in 32 bits,and it isn't a reason to write a corrupted obj (bad PE file).
The prog have i have posted is perfectly compiled by this version of JWASm:
http://masm32.com/board/index.php?topic=4256.msg45375#msg45375
Don't search newbe error in the compiled,I am not one of them.

Fa is a musical note to play with CL

nidud

#32
deleted

TouEnMasm

Here is what say dumpbin about the obj i have posted
Quote
Microsoft (R) COFF/PE Dumper Version 14.00.23026.0
Copyright (C) Microsoft Corporation.  All rights reserved.


Dump of file essai_sdk.obj
essai_sdk.obj : warning LNK4048: invalid file format ; ignored

  Summary
Fa is a musical note to play with CL

TouEnMasm

Explain given by objconv,the compiled option are good with other jwasm,hjwasm
OMF32 instead off COFF32
Quote
Dump of file: essai_sdk.obj, type: OMF32
Summary of records:
  Record 80, Translator Header, total length 18
  Record 88, Comment, total length 15
  Record 88, Comment, total length 16
  Record 88, Comment, total length 18
  Record 88, Comment, total length 18
  Record 88, Comment, total length 18
  Record 88, Comment, total length 17
  Record 88, Comment, total length 18
  Record 88, Comment, total length 15
  Record 88, Comment, total length 18
  Record 88, Comment, total length 16
  Record 96, List of Names, total length 44
  Record 98, Segment Definition, total length 10
  Record 88, Comment, total length 8
  Record 98, Segment Definition, total length 10
  Record 98, Segment Definition, total length 10
  Record 9A, Group Definition, total length 5
  Record 8C, External Names Definition, total length 63
  Record 90, Public Names Definition, total length 37
  Record 88, Comment, total length 7
  Record A0, Enumerated Data, total length 25
  Record A0, Enumerated Data, total length 71
  Record 9D, Fixup.32, total length 26
  Record 8A, Module End, total length 5

Local names:
  Module: essai_sdk.asm

   1
   2  FLAT
   3  CODE
   4  _TEXT
   5  DATA
   6  _DATA
   7  CONST
   8  CONST

External names:
   1  _MessageBoxA@16, Type 0
   2  __set_invalid_parameter_handler, Type 0
   3  __getch, Type 0

Public names:
  _invalid_parameter, Segment _TEXT, Group FLAT, Offset 0x0, Type 0
  _main, Segment _TEXT, Group FLAT, Offset 0x24, Type 0

Segment records:
  Segment  1, Name _TEXT, Class CODE, Align 16, Public, 32 bit, Length 64
   Overlay 1
  Segment  2, Name _DATA, Class DATA, Align 16, Public, 32 bit, Length 18
   Overlay 1
  Segment  3, Name CONST, Class CONST, Align 16, Public, 32 bit, Length 0
   Overlay 1

Group records:
  Group: FLAT
   Segments:

LEDATA, LIDATA, COMDAT and FIXUPP records:
  LEDATA: segment _DATA, Offset 0x0, Size 0x12
  LEDATA: segment _TEXT, Offset 0x0, Size 0x40
  FIXUPP:
   Direct 32 bit, Offset 0x12, group FLAT. Segment _DATA (T4), inline 0x0
   Relatv 32 bit, Offset 0x19, frame = target. Symbol _MessageBoxA@16 (T6), inline 0x0
   Direct 32 bit, Offset 0x28, group FLAT. Segment _TEXT (T4), inline 0x0
   Relatv 32 bit, Offset 0x2D, frame = target. Symbol __set_invalid_parameter_handler (T6), inline 0x0
   Relatv 32 bit, Offset 0x35, frame = target. Symbol __getch (T6), inline 0x0
Fa is a musical note to play with CL

TouEnMasm

Final explain Don't understand the JWASM constant but only HJWASM
SET HJWASM=/c /coff /nologo
The jwasm.exe provided with the pack understand JWASM
Fa is a musical note to play with CL

TouEnMasm

Release version seem ok,but:64 bits version debug
Fa is a musical note to play with CL

HSE

Fun never end :biggrin:

http://masm32.com/board/index.php?topic=3225.msg56532#msg56532

Even me can solve the issue with qWord notes and explanation!

Regards. HSE
Equations in Assembly: SmplMath

TouEnMasm

#38
with
Quote
;-----------
foostr TEXTEQU <xyz>
foo SIZESTR foostr
%echo @CatStr(%foo)
IF foo GT 1
echo foo GT 1
ELSE
echo should be dead code
ENDIF
foo = foo - 100 ; <--- does set asym.value3264 to -1
foo SIZESTR foostr ; <-- CreateVariable() does not zero asym.value3264, if equate already exist.
%echo @CatStr(%foo)
IF foo GT 1
echo foo GT 1
ELSE
echo should be dead code
ENDIF
foo INSTR foostr,
%echo looks nice: @CatStr(%foo)
;-----------
I get
Quote
3
foo GT 1
-4294967293
should be dead code
StatDyn.asm(47) : Error A2065: Constant expected

How to modify the CreateVariable function ,in equate.c?
Quote
struct asym *CreateVariable( const char *name, int value )
/********************************************************/
{
    struct asym      *sym;

    DebugMsg1(( "CreateVariable(%s, %d ) enter\n", name, value ));

    sym = SymSearch( name );
    if( sym == NULL ) {
        sym = SymCreate( name );
#if FASTPASS
        //sym->issaved = FALSE;
        sym->issaved = StoreState; /* v2.10 */
#endif
    } else if ( sym->state == SYM_UNDEFINED ) {
        sym->value3264 = 0; /* v2.13: added qWord indication H E R E <<<<<<<<<<<<<<<<<<<<<*/
        sym_remove_table( &SymTables[TAB_UNDEF], (struct dsym *)sym );
        sym->fwdref = TRUE;
#if FASTPASS
        sym->issaved = StoreState; /* v2.10 */
#endif
    } else {
        sym->value3264 = 0; /* v2.13: added qWord indication   H E R E <<<<<<<<<<<<<<<<<<<<<*/
        if ( sym->isequate == FALSE ) {

            EmitErr( SYMBOL_REDEFINITION, name );
            return( NULL );
        }
#if FASTPASS
        /*
         * v2.09: don't save variable when it is defined the first time
         * v2.10: store state only when variable is changed and has been
         * defined BEFORE SaveState() has been called.
         */
        //if ( StoreState && sym->issaved == FALSE && sym->isdefined == TRUE ) {
        if ( StoreState && sym->issaved == FALSE ) {
            SaveVariableState( sym );
        }
#endif
    }
    sym->isdefined  = TRUE;
    sym->state    = SYM_INTERNAL;
    //sym->mem_type = MT_ABS;
    sym->variable = TRUE;
    sym->value    = value;
    sym->isequate = TRUE;
    return( sym );
}



Fa is a musical note to play with CL

HSE

Hi Yves!

Perhaps there is another way but is working.

struct asym *CreateVariable( const char *name, int value )
/********************************************************/
{
    struct asym      *sym;

    DebugMsg1(( "CreateVariable(%s, %d ) enter\n", name, value ));

    sym = SymSearch( name );
 
  if( sym == NULL ) {
        sym = SymCreate( name );
#if FASTPASS
        sym->issaved = FALSE;
        //sym->issaved = StoreState; /* v2.10 */
#endif
    } else if ( sym->state == SYM_UNDEFINED ) {

     sym->value3264 = 0; /* v2.13: added qWord indication                H E R E */
 
  //sym->uvalue    = 0;
        sym_remove_table( &SymTables[TAB_UNDEF], (struct dsym *)sym );
        sym->fwdref = TRUE;
#if FASTPASS
        sym->issaved = StoreState; /* v2.10 */
#endif
    } else {
    sym->value3264 = 0; /* v2.13: added qWord indication                H E R E */
 
    if ( sym->isequate == FALSE ) {
            EmitErr( SYMBOL_REDEFINITION, name );
            return( NULL );
        }
#if FASTPASS
        /*
         * v2.09: don't save variable when it is defined the first time
         * v2.10: store state only when variable is changed and has been
         * defined BEFORE SaveState() has been called.
         */
        //if ( StoreState && sym->issaved == FALSE && sym->isdefined == TRUE ) {
        if ( StoreState && sym->issaved == FALSE ) {
            SaveVariableState( sym );
        }
#endif
    }
    sym->isdefined  = TRUE;
    sym->state    = SYM_INTERNAL;
    //sym->mem_type = MT_ABS;
    sym->variable = TRUE;
    sym->value    = value;
    //sym->uvalue    = 0;
    sym->isequate = TRUE;
    return( sym );
}

/*
* CreateConstant()
* this is the worker behind EQU.
* EQU may define 3 different types of equates:
* - numeric constants (with or without "type")
* - relocatable items ( aliases )
* - text macros
* the argument may be
* - an expression which can be evaluated to a number or address
* - a text literal (enclosed in <>)
* - anything. This will also become a text literal.
*/
Equations in Assembly: SmplMath

TouEnMasm


Thanks better result like that
Quote
3
foo GT 1
3
foo GT 1
StatDyn.asm(46) : Error A2065: Constant expected
Fa is a musical note to play with CL

habran

Hi ToutEnMasm,
that bug in debugger version happens probably because of myassert()
try to build when they are isolated in the souce
Cod-Father

habran

Thanks HSE :t
it will be fixed in next upload but for now you can use this one to build:

struct asym *CreateVariable( const char *name, int value )
/********************************************************/
{
    struct asym      *sym;

    DebugMsg1(( "CreateVariable(%s, %d ) enter\n", name, value ));

    sym = SymSearch( name );
    if( sym == NULL ) {
        sym = SymCreate( name );
#if FASTPASS
        //sym->issaved = FALSE;
        sym->issaved = StoreState; /* v2.10 */
#endif
    } else if ( sym->state == SYM_UNDEFINED ) {
        sym->value3264 = 0;   //fixed by HSE on qWord indication
        sym_remove_table( &SymTables[TAB_UNDEF], (struct dsym *)sym );
        sym->fwdref = TRUE;
#if FASTPASS
        sym->issaved = StoreState; /* v2.10 */
#endif
    } else {
        sym->value3264 = 0;  //fixed by HSE on qWord indication
        if ( sym->isequate == FALSE ) {
            EmitErr( SYMBOL_REDEFINITION, name );
            return( NULL );
        }
#if FASTPASS
        /*
         * v2.09: don't save variable when it is defined the first time
         * v2.10: store state only when variable is changed and has been
         * defined BEFORE SaveState() has been called.
         */
        //if ( StoreState && sym->issaved == FALSE && sym->isdefined == TRUE ) {
        if ( StoreState && sym->issaved == FALSE ) {
            SaveVariableState( sym );
        }
#endif
    }
    sym->isdefined  = TRUE;
    sym->state    = SYM_INTERNAL;
    //sym->mem_type = MT_ABS;
    sym->variable = TRUE;
    sym->value    = value;
    sym->isequate = TRUE;
    return( sym );
}

Cod-Father

HSE

It's very important that qWord's macros work properly, because they are very useful for specific purposes and, more in general, they are exploiting the amazing macro capabilities of MASM  :t

Thanks. HSE
Equations in Assembly: SmplMath

TouEnMasm

Quote
habran: "that bug in debugger version happens probably because of myassert()
try to build when they are isolated in the souce  "
How can I do that ?
Fa is a musical note to play with CL