diff mbox

multiboot.S patch for old as(1) (was: Re: [Qemu-devel] Some OpenBSD/amd64 build fixes)

Message ID 20091013212912.GA11529@triton8.kn-bremen.de
State New
Headers show

Commit Message

Juergen Lock Oct. 13, 2009, 9:29 p.m. UTC
On Wed, Sep 23, 2009 at 10:55:02PM +0200, Juergen Lock wrote:
> On Wed, Sep 23, 2009 at 09:31:16PM +0100, Laurence Tratt wrote:
>[...]
> >  then the above error doesn't occur, but
> > pc-bios/optionrom/multiboot.S dies as follows:
> > 
> >   $
> >     AS    optionrom/multiboot.o
> >   multiboot.S: Assembler messages:
> >   multiboot.S:116: Error: `%es:-4(%edi)' is not a valid 16 bit base/index
> > expression
> >   $
> > 
> > What little Intel assembler I ever knew has long since departed from my
> > brain, so I don't know why that error occurs, nor what a fix might be.
> > 
>  It occurs because of too old binutils (as(1) in this case), on FreeBSD
> we now have a port for newer ones,
> 	http://www.freshports.org/devel/binutils
> so I depend on that and have the optionrom Makefile use the new as
> like this: (the first change wrt CFLAGS is unrelated and has probably
> been fixed in the meantime; it caused gmake to complain about
> recursive use of CFLAGS.)
> 
> Index: qemu/pc-bios/optionrom/Makefile
> @@ -9,10 +9,13 @@
>  
>  CFLAGS = -Wall -Wstrict-prototypes -Werror -fomit-frame-pointer -fno-builtin
>  CFLAGS += -I$(SRC_PATH)
> -CFLAGS += $(call cc-option, $(CFLAGS), -fno-stack-protector,"")
> +CFLAGS := $(CFLAGS) $(call cc-option, $(CFLAGS), -fno-stack-protector,"")
>  
>  build-all: multiboot.bin
>  
> +%.o: %.S
> +	$(CC) -E $(CFLAGS) -o - -c $< |${LOCALBASE}/bin/as -V -Qy -o $@
> +
>  %.img: %.o
>  	$(call quiet-command,$(LD) -Ttext 0 -e _start -s -o $@ $<,"  Building $(TARGET_DIR)$@")
>  

That patch didn't seem to help on OpenBSD so I now finally got around
making another one that just emits the bytes of the offending insn
instead so people can keep using old assemblers:


 Signed-off-by: Juergen Lock <nox@jelal.kn-bremen.de>

Comments

Paolo Bonzini Oct. 14, 2009, 2:29 p.m. UTC | #1
On 10/13/2009 11:29 PM, Juergen Lock wrote:
> +	.dc.b		0x26,0x67,0x66,0x89,0x4f,0xfc

If anything, this would be easier to read:

	.dc.b		0x26		/* %es: prefix for old as(1) */
	movl		%ecx, -4(%edi)

Paolo
Juergen Lock Oct. 14, 2009, 7:18 p.m. UTC | #2
On Wed, Oct 14, 2009 at 04:29:32PM +0200, Paolo Bonzini wrote:
> On 10/13/2009 11:29 PM, Juergen Lock wrote:
> > +	.dc.b		0x26,0x67,0x66,0x89,0x4f,0xfc
> 
> If anything, this would be easier to read:
> 
> 	.dc.b		0x26		/* %es: prefix for old as(1) */
> 	movl		%ecx, -4(%edi)
> 
I like the idea, but unfortunately old as (2.15) doesnt, it still says:
	Error: `-4(%edi)' is not a valid 16 bit base/index expression

 :(,
	Juergen
diff mbox

Patch

--- a/pc-bios/optionrom/multiboot.S
+++ b/pc-bios/optionrom/multiboot.S
@@ -113,7 +113,10 @@  mmap_loop:
 	/* entry size (mmap struct) & max buffer size (int15) */
 	movl		$20, %ecx
 	/* store entry size */
+	/* old as(1) doesn't like this insn so emit the bytes instead:
 	movl		%ecx, %es:-4(%edi)
+	*/
+	.dc.b		0x26,0x67,0x66,0x89,0x4f,0xfc
 	/* e820 */
 	movl		$0x0000e820, %eax
 	/* 'SMAP' magic */