Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!rutgers!lll-lcc!seismo!mcvax!ukc!warwick!jmc From: jmc@warwick.UUCP Newsgroups: comp.bugs.sys5,comp.lang.c Subject: .comm - bug or feature? Message-ID: <490@ubu.warwick.UUCP> Date: Tue, 10-Feb-87 16:17:46 EST Article-I.D.: ubu.490 Posted: Tue Feb 10 16:17:46 1987 Date-Received: Fri, 13-Feb-87 20:40:59 EST Reply-To: jmc@ubu.UUCP (John Collins) Organization: Computer Science, Warwick University, UK Lines: 26 Xref: watmath comp.bugs.sys5:70 comp.lang.c:1016 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