Subject: New Toolchain's gas lossage on m68k
To: None <>
From: Steve Woodford <>
List: tech-toolchain
Date: 11/07/2001 22:36:27

In one of my earlier emails I alluded to a problem with new Gas when
compiling m68k's FPSP assembly source.

Specifically, the following code test case will fail to assemble:

oor-wullie% cat > foo.s
	.globl	foo

	.space	200

baz:	bras	foo
foo:	rts

oor-wullie% as -o foo.o foo.s
foo.s:6: Error: Value of -202 too large for field of 1 bytes at 201

Changing the `bras' to simply `bra' works around the problem (but is not
the correct fix IMO). Removing the `.globl foo' also fixes the problem,
and herein lies the root of the issue.

According to comments in the source (eg. gas/config/tc-m68k.h:170),
externally visible symbols may be overridden by shared libraries, so the
assembler cannot do the relocation at assembly time. This bites m68k's
relative branches because the offsets can be 8, 16 or 32-bits in size.

Presumably the assembler is doing TRT as per ELF's requirements, but there
must be a better way to do this other than hacking our in-tree assembly

What does gas do on other cpus with variable branch offset sizes?

Cheers, Steve