Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#8 "ABSOLUTE label" assembles wrong

closed-fixed
None
5
2002-05-26
2002-05-18
Debbie Wiles
No

When using the ABSOLUTE directive to place data at a
set position in a file in the BIN format, if a label
is used to define the absolute position of the data
(as per the docs), nasm kicks up a load of warnings
and then adds data initialised to zero at the point in
the file where it is defined. It should treat it as
reserved data at the specified position. If a numeric
value is used, it assembles correctly.

A small example that demonstrates the problem is:

org 0
bits 16

start:

times 32 nop

absolute start

gdtsel:
.segLimit resw 1
.BaseA15_A00 resw 1
.BaseA23_A16 resb 1
.AccessRights resb 1
.Limit_A19_16 resb 1
.BaseA31_A24 resb 1

rmcs equ $-gdtsel
rmcs_:
.segLimit resw 1
.BaseA15_A00 resw 1
.BaseA23_A16 resb 1
.AccessRights resb 1
.Limit_A19_16 resb 1
.BaseA31_A24 resb 1

When assembled to BIN format, this should be 32 nops,
and nothing else. In fact, it will give 12 warnings
(one for each res*), and treat it as "d*" instead
of "res*", initialising to zeros.

Discussion

  • Debbie Wiles
    Debbie Wiles
    2002-05-18

    • summary: "ABSOLUTE label" assembles wrong --> "ABSOLUTE label" assembles wrong
     
  • Debbie Wiles
    Debbie Wiles
    2002-05-18

    Logged In: YES
    user_id=363603

    The warning messages are all of the following form:

    test.asm:13: warning: uninitialised space declared in .text
    section: zeroing

     
  • Debbie Wiles
    Debbie Wiles
    2002-05-18

    • summary: "ABSOLUTE label" assembles wrong --> "ABSOLUTE label" assembles wrong
     
  • Debbie Wiles
    Debbie Wiles
    2002-05-18

    Logged In: YES
    user_id=363603

    Further testing has revealed a few more details.

    The first version that recognised the ABSOLUTE directive is
    0.94.

    0.94 and 0.95 gave the following error:

    test.asm:8: invalid address specified for ABSOLUTE directive

    0.96 and 0.97 both gave the following error:

    test.asm:18: invalid operand type

    Line 18 is:

    rmcs equ $-gdtsel

    Obviously that bug is fixed, but that also shows that the
    absolute directive with a label as an arguement worked in
    0.96 and 0.97, and it has been broken again since 0.98,
    with different errors as described previously.

     
  • H. Peter Anvin
    H. Peter Anvin
    2002-05-25

    Logged In: YES
    user_id=58697

    The currently checked in CVS tree will accept an absolute
    expression, but nothing else. Handling segment-based
    ABSOLUTEs would require quite a bit of work; it should be
    taken care of, but I believe we have agreed that the current
    behaviour (as opposed to the 0.98.32 behaviour) is
    acceptable for 0.99.

     
  • H. Peter Anvin
    H. Peter Anvin
    2002-05-25

    • summary: "ABSOLUTE label" assembles wrong --> "ABSOLUTE label" assembles wrong
    • status: open --> open-postponed
     
  • H. Peter Anvin
    H. Peter Anvin
    2002-05-26

    • assigned_to: nobody --> hpa
    • summary: "ABSOLUTE label" assembles wrong --> "ABSOLUTE label" assembles wrong
    • status: open-postponed --> open-accepted
     
  • H. Peter Anvin
    H. Peter Anvin
    2002-05-26

    Logged In: YES
    user_id=58697

    I'm taking this on again. Partial fix checked in, now
    looking for remaining issues...

     
  • H. Peter Anvin
    H. Peter Anvin
    2002-05-26

    Logged In: YES
    user_id=58697

    I believe the current code should work correctly in all
    cases. It's a big ugly, perhaps.

     
  • H. Peter Anvin
    H. Peter Anvin
    2002-05-26

    • summary: "ABSOLUTE label" assembles wrong --> "ABSOLUTE label" assembles wrong
    • status: open-accepted --> closed-fixed