.comm - bug or feature?
jmc at warwick.UUCP
jmc at warwick.UUCP
Wed Feb 11 07:17:46 AEST 1987
In porting UNIX V.3 onto a new chipset I discovered a curiosity in the 3b2
assembler/loader.
.comm x,4
(instruction refering to x)
has "4" in the displacement not 0 - the same as the "value" field, which
distinguishes ".comm" from an undefined external.
The loader subtracts the value field whatever it means from the relocated
position.
Everything ends up in the right place, unless you are naive enough (like me
of course) to write your own assembler which puts "0" in the displacement.
Then the undoctored loader ends up subtracting 4 from the address with
unfortunate effects if you are trying to debug a sparkling new kernel!
I cannot believe it is logically correct to treat the value field in this
way although the two bug(?)s compensate.
Note that an ordinary undefined goes in as 0.
Any Comments?
John Collins, Xi Software Ltd, ..... xisl!jmc
More information about the Comp.lang.c
mailing list