[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
as: redefinition of relocatable items fails
From: |
Albert van der Horst |
Subject: |
as: redefinition of relocatable items fails |
Date: |
Wed, 24 Nov 2004 16:37:50 +0100 |
User-agent: |
Mutt/1.3.28i |
Dear Sir,
This is a defect report against ``gnu as 2.15'' :
"
.equ cannot handle redefinition for relocatable values.
"
Apparently .equ can handle redefinitions okay.
It has no problems with relocatable values, or with
a constant defined as the difference between relocatables.
This is shown in the following example :
-----------8<----------------------------
GAS LISTING aap.s page 1
1
2 _START:
3 .equ AAP, 5
4 0000 05000000 .long AAP # Expect 5. Okay.
5 .equ AAP, 7
6 0004 07000000 .long AAP # Expect 7. Okay.
7 .equ NOOT, .
8 0008 08000000 .long NOOT # Expect 8, but relocatable.
Okay.
9 .equ MIES, .- _START
10 000c 0C000000 .long MIES # Expect 0x0c not relocatable.
Okay.
11 .equ AAP, 11
12 0010 0B000000 .long AAP # Expect 11. Okay.
GAS LISTING aap.s page 2
DEFINED SYMBOLS
aap.s:2 .text:00000000 _START
aap.s:3 *ABS*:0000000b AAP
aap.s:7 .text:00000008 NOOT
aap.s:9 *ABS*:0000000c MIES
NO UNDEFINED SYMBOLS
-----------8<----------------------------
However, when redefining a name with a relocatable value,
the results are incorrect, or I believe so.
-----------8<----------------------------
GAS LISTING jan.s page 1
1
2 _START:
3 0000 8C8B8A89 .long 0x898a8b8c
4 .equ AAP, .
5 0004 0C000000 .long AAP # Expect 4. What?
6 .equ AAP, .
7 0008 0C000000 .long AAP # Expect 8. What?
8 .equ AAP, .
9 000c 0C000000 .long AAP # Expect c. last value
apparently correct.
GAS LISTING jan.s page 2
DEFINED SYMBOLS
jan.s:2 .text:0000000000000000 _START
jan.s:8 .text:000000000000000c AAP
NO UNDEFINED SYMBOLS
-----------8<----------------------------
For your convenience I added both assembler files in the
attachments. Apparently, mails with attachments are refused,
so I resent this without the attahments.
[The result is even more strange if you redefine AAP later
with a constant value. You are advised to look into that, as it
can give an indication of what is going on. I have this
example in the attachment noot.s. This is of course slightly
naughty, so I did not want to present that as the defect.]
A note:
The ability to redefine a relocatable is a valuable feature for
something I'm doing: laying down linked lists.
.equ link, .
.long <d1> ; Some data structure
.long <d2>
...
.long oldlink
...
.equ oldlink, link
This structure can be repeated indefinitely, without the need
to define a "ganze Unmenge" of labels, and the textual manipulations
that go with them.
Groetjes
Albert
--
Albert van der Horst,Oranjestr 8,3511 RA UTRECHT,THE NETHERLANDS
One man-hour to invent,
One man-week to implement,
One lawyer-year to patent.
address@hidden http://home.hccnet.nl/a.w.m.van.der.horst
_START:
.equ AAP, .
.long AAP # Expect 0. What?
.equ AAP, .
.long AAP # Expect 4. What?
.equ NOOT, .
.long NOOT # Expect 8, but relocatable. Okay.
.equ MIES, .- _START
.long MIES # Expect c, not relocatable. Okay.
.equ AAP, 11
.long AAP # Expect 10. Okay.
_START:
.long 0x898a8b8c
.equ AAP, .
.long AAP # Expect 4. What?
.equ AAP, .
.long AAP # Expect 8. What?
.equ AAP, .
.long AAP # Expect c. last value apparently correct.
_START:
.equ AAP, 5
.long AAP # Expect 5. Okay.
.equ AAP, 7
.long AAP # Expect 7. Okay.
.equ NOOT, .
.long NOOT # Expect 8, but relocatable. Okay.
.equ MIES, .- _START
.long MIES # Expect 0x0c not relocatable. Okay.
.equ AAP, 11
.long AAP # Expect 11. Okay.
--
Albert van der Horst,Oranjestr 8,3511 RA UTRECHT,THE NETHERLANDS
One man-hour to invent,
One man-week to implement,
One lawyer-year to patent.
address@hidden http://home.hccnet.nl/a.w.m.van.der.horst