Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 30 Jan 2013 01:05:25 +0000 (UTC)
From:      Benno Rice <benno@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r246104 - in projects/uefi/sys/boot: . efi efi/include/i386 efi/libefi ficl ficl64 i386 i386/boot2 i386/efi i386/efi/amd64 i386/efi/i386 zfs zfs64
Message-ID:  <201301300105.r0U15PB3024533@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: benno
Date: Wed Jan 30 01:05:24 2013
New Revision: 246104
URL: http://svnweb.freebsd.org/changeset/base/246104

Log:
  Make the EFI loader build as 64-bit on amd64.
  
  This may cause further problems with the 32-bit boot code which hasn't been
  tested with these changes yet.
  
  Sponsored by:	FreeBSD Foundation

Added:
  projects/uefi/sys/boot/i386/efi/amd64/
  projects/uefi/sys/boot/i386/efi/amd64/start.S
  projects/uefi/sys/boot/i386/efi/i386/
  projects/uefi/sys/boot/i386/efi/i386/start.S
  projects/uefi/sys/boot/zfs64/
  projects/uefi/sys/boot/zfs64/Makefile
Modified:
  projects/uefi/sys/boot/Makefile.amd64
  projects/uefi/sys/boot/efi/Makefile.inc
  projects/uefi/sys/boot/efi/include/i386/efibind.h
  projects/uefi/sys/boot/efi/libefi/Makefile
  projects/uefi/sys/boot/ficl/Makefile
  projects/uefi/sys/boot/ficl64/Makefile
  projects/uefi/sys/boot/i386/Makefile.inc
  projects/uefi/sys/boot/i386/boot2/Makefile
  projects/uefi/sys/boot/i386/efi/Makefile
  projects/uefi/sys/boot/i386/efi/ldscript.amd64
  projects/uefi/sys/boot/zfs/Makefile

Modified: projects/uefi/sys/boot/Makefile.amd64
==============================================================================
--- projects/uefi/sys/boot/Makefile.amd64	Wed Jan 30 00:58:10 2013	(r246103)
+++ projects/uefi/sys/boot/Makefile.amd64	Wed Jan 30 01:05:24 2013	(r246104)
@@ -1,5 +1,7 @@
 # $FreeBSD$
 
 SUBDIR+=		efi
+SUBDIR+=		ficl64
 SUBDIR+=		zfs
+SUBDIR+=		zfs64
 SUBDIR+=		userboot

Modified: projects/uefi/sys/boot/efi/Makefile.inc
==============================================================================
--- projects/uefi/sys/boot/efi/Makefile.inc	Wed Jan 30 00:58:10 2013	(r246103)
+++ projects/uefi/sys/boot/efi/Makefile.inc	Wed Jan 30 01:05:24 2013	(r246104)
@@ -2,17 +2,10 @@
 
 BINDIR?=	/boot
 
-.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64"
+.if ${MACHINE_CPUARCH} == "i386"
 CFLAGS+=        -march=i386
 .endif
 
-.if ${MACHINE_CPUARCH} == "amd64"
-CFLAGS+=        -m32
-ACFLAGS+=       -m32
-LDFLAGS+=       -m elf_i386_fbsd
-AFLAGS+=        --32
-.endif
-
 # Options used when building app-specific efi components
 CFLAGS+=	-ffreestanding -fshort-wchar -Wformat
 LDFLAGS+=	-nostdlib

Modified: projects/uefi/sys/boot/efi/include/i386/efibind.h
==============================================================================
--- projects/uefi/sys/boot/efi/include/i386/efibind.h	Wed Jan 30 00:58:10 2013	(r246103)
+++ projects/uefi/sys/boot/efi/include/i386/efibind.h	Wed Jan 30 01:05:24 2013	(r246104)
@@ -155,6 +155,11 @@ typedef uint32_t   UINTN;
 // RUNTIME_CODE - pragma macro for declaring runtime code    
 //
 
+/* XXX: This attribute only works on gcc >= 4.7 for now. */
+#ifdef	__amd64__
+#define	EFIAPI	__attribute__((ms_abi))
+#endif
+
 #ifndef EFIAPI                  // Forces EFI calling conventions reguardless of compiler options 
     #if _MSC_EXTENSIONS
         #define EFIAPI __cdecl  // Force C calling convention for Microsoft C compiler 

Modified: projects/uefi/sys/boot/efi/libefi/Makefile
==============================================================================
--- projects/uefi/sys/boot/efi/libefi/Makefile	Wed Jan 30 00:58:10 2013	(r246103)
+++ projects/uefi/sys/boot/efi/libefi/Makefile	Wed Jan 30 01:05:24 2013	(r246104)
@@ -6,6 +6,7 @@ INTERNALLIB=
 SRCS=	delay.c efi_console.c efinet.c efipart.c errno.c handles.c \
 	libefi.c time.c
 
+CFLAGS+= -fPIC
 CFLAGS+= -I${.CURDIR}/../include
 CFLAGS+= -I${.CURDIR}/../include/${MACHINE_CPUARCH:S/amd64/i386/}
 CFLAGS+= -I${.CURDIR}/../../../../lib/libstand

Modified: projects/uefi/sys/boot/ficl/Makefile
==============================================================================
--- projects/uefi/sys/boot/ficl/Makefile	Wed Jan 30 00:58:10 2013	(r246103)
+++ projects/uefi/sys/boot/ficl/Makefile	Wed Jan 30 01:05:24 2013	(r246104)
@@ -56,14 +56,20 @@ CFLAGS+=	-m32 -I.
 CFLAGS+=	-m32 -mcpu=powerpc -I.
 .endif
 
-CFLAGS+=	-I${FICLDIR} -I${FICLDIR}/${MACHINE_CPUARCH:S/amd64/i386/} \
+.if ${MACHINE_CPUARCH} == "amd64" && !defined(FICL64)
+FICL_CPUARCH=	${FICLDIR}/i386
+.else
+FICL_CPUARCH=	${FICLDIR}/${MACHINE_CPUARCH}
+.endif
+
+CFLAGS+=	-I${FICLDIR} -I${FICL_CPUARCH} \
 		-I${FICLDIR}/../common
 
 softcore.c: ${SOFTWORDS} softcore.awk
 	(cd ${FICLDIR}/softwords; cat ${SOFTWORDS} \
 	    | awk -f softcore.awk -v datestamp="`LC_ALL=C date`") > ${.TARGET}
 
-.if ${MACHINE_CPUARCH} == "amd64"
+.if ${MACHINE_CPUARCH} == "amd64" && !defined(FICL64)
 .if !exists(machine)
 ${SRCS:M*.c:R:S/$/.o/g}: machine
 

Modified: projects/uefi/sys/boot/ficl64/Makefile
==============================================================================
--- projects/uefi/sys/boot/ficl64/Makefile	Wed Jan 30 00:58:10 2013	(r246103)
+++ projects/uefi/sys/boot/ficl64/Makefile	Wed Jan 30 01:05:24 2013	(r246104)
@@ -3,6 +3,8 @@
 FICL64=
 FICLDIR=	${.CURDIR}/../ficl
 
+CFLAGS+=	-fPIC
+
 .PATH:	${FICLDIR}
 
 .include "${FICLDIR}/Makefile"

Modified: projects/uefi/sys/boot/i386/Makefile.inc
==============================================================================
--- projects/uefi/sys/boot/i386/Makefile.inc	Wed Jan 30 00:58:10 2013	(r246103)
+++ projects/uefi/sys/boot/i386/Makefile.inc	Wed Jan 30 01:05:24 2013	(r246104)
@@ -5,14 +5,18 @@
 BINDIR?=	/boot
 
 LOADER_ADDRESS?=0x200000
-CFLAGS+=	-march=i386 -ffreestanding -mpreferred-stack-boundary=2 \
-		-mno-mmx -mno-3dnow -mno-sse -mno-sse2 -mno-sse3 -msoft-float
+CFLAGS+=	-ffreestanding -mno-mmx -mno-3dnow -mno-sse -mno-sse2 \
+		    -mno-sse3 -msoft-float
+.if ${MACHINE_CPUARCH} == "i386"
+CFLAGS+=	-march=i386 -mpreferred-stack-boundary=2
+.elif ${MACHINE_CPUARCH} == "amd64" && !defined(BUILDING_EFI)
+CFLAGS+=	-march=i386 -mpreferred-stack-boundary=2
+.endif
 LDFLAGS+=	-nostdlib
 
-.if ${MACHINE_CPUARCH} == "amd64"
+.if ${MACHINE_CPUARCH} == "amd64" && !defined(BUILDING_EFI)
 CFLAGS+=	-m32
 ACFLAGS+=	-m32
-LDFLAGS+=	-m elf_i386_fbsd
 AFLAGS+=	--32
 .endif
 

Modified: projects/uefi/sys/boot/i386/boot2/Makefile
==============================================================================
--- projects/uefi/sys/boot/i386/boot2/Makefile	Wed Jan 30 00:58:10 2013	(r246103)
+++ projects/uefi/sys/boot/i386/boot2/Makefile	Wed Jan 30 01:05:24 2013	(r246104)
@@ -26,7 +26,7 @@ CFLAGS=	-Os \
 	-fno-guess-branch-probability \
 	-fomit-frame-pointer \
 	-fno-unit-at-a-time \
-	-mno-align-long-strings \
+	-Wl,-mno-align-long-strings \
 	-mrtd \
 	-mregparm=3 \
 	-DUSE_XREAD \
@@ -59,7 +59,8 @@ boot1: boot1.out
 	objcopy -S -O binary boot1.out ${.TARGET}
 
 boot1.out: boot1.o
-	${LD} ${LDFLAGS} -e start -Ttext ${ORG1} -o ${.TARGET} boot1.o
+	${LD} ${LDFLAGS} -m elf_i386_fbsd -e start -Ttext ${ORG1} \
+	    -o ${.TARGET} boot1.o
 
 CLEANFILES+=	boot2 boot2.ld boot2.ldr boot2.bin boot2.out boot2.o \
 		boot2.s boot2.s.tmp boot2.h sio.o
@@ -80,7 +81,8 @@ boot2.bin: boot2.out
 	objcopy -S -O binary boot2.out ${.TARGET}
 
 boot2.out: ${BTXCRT} boot2.o sio.o
-	${LD} ${LDFLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC}
+	${LD} ${LDFLAGS} -m elf_i386_fbsd -Ttext ${ORG2} -o ${.TARGET} \
+	    ${.ALLSRC}
 
 boot2.o: boot2.s
 	${CC} ${ACFLAGS} -c boot2.s

Modified: projects/uefi/sys/boot/i386/efi/Makefile
==============================================================================
--- projects/uefi/sys/boot/i386/efi/Makefile	Wed Jan 30 00:58:10 2013	(r246103)
+++ projects/uefi/sys/boot/i386/efi/Makefile	Wed Jan 30 01:05:24 2013	(r246104)
@@ -10,9 +10,13 @@ PROG=		loader.sym
 INTERNALPROG=
 
 # architecture-specific loader code
-SRCS=	main.c exec.c conf.c vers.c reloc.c start.S elf32_freebsd.c
+SRCS=	main.c exec.c conf.c vers.c reloc.c elf32_freebsd.c
 SRCS+=	i386_copy.c bootinfo.c autoload.c devicename.c efimd.c
 
+.PATH:	${.CURDIR}/${MACHINE_CPUARCH}
+SRCS+=	start.S
+
+CFLAGS+=	-fPIC
 CFLAGS+=	-I${.CURDIR}/../../efi/include
 CFLAGS+=	-I${.CURDIR}/../../efi/include/i386
 
@@ -20,9 +24,13 @@ CFLAGS+=	-I${.CURDIR}/../../efi/include/
 BOOT_FORTH=	yes
 CFLAGS+=	-DBOOT_FORTH
 CFLAGS+=	-I${.CURDIR}/../../ficl
-CFLAGS+=	-I${.CURDIR}/../../ficl/i386
+CFLAGS+=	-I${.CURDIR}/../../ficl/${MACHINE_CPUARCH}
+.if ${MACHINE_CPUARCH} == "amd64"
+LIBFICL=	${.OBJDIR}/../../ficl64/libficl.a
+.else
 LIBFICL=	${.OBJDIR}/../../ficl/libficl.a
 .endif
+.endif
 
 # Include bcache code.
 HAVE_BCACHE=    yes
@@ -35,14 +43,14 @@ CFLAGS+=	-I${.CURDIR}/../../common
 FILES=	loader.efi
 FILESMODE_loader.efi=	${BINMODE}
 
-LDSCRIPT=	${.CURDIR}/ldscript.i386
-LDFLAGS=	-Wl,-T${LDSCRIPT} -Wl,-Bsymbolic -shared
+LDSCRIPT=	${.CURDIR}/ldscript.${MACHINE_CPUARCH}
+LDFLAGS=	-Wl,-T${LDSCRIPT} -Wl,-Bsymbolic -shared -Wl,-znocombreloc
 
 ${PROG}:	${LDSCRIPT}
 
 CLEANFILES=	vers.c loader.efi
 
-NEWVERSWHAT=	"EFI loader" x86
+NEWVERSWHAT=	"EFI loader" ${MACHINE_CPUARCH}
 
 vers.c:	${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version
 	sh ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version ${NEWVERSWHAT}
@@ -50,14 +58,21 @@ vers.c:	${.CURDIR}/../../common/newvers.
 OBJCOPY?=	objcopy
 OBJDUMP?=	objdump
 
+.if ${MACHINE_CPUARCH} == "amd64"
+EFI_TARGET=	efi-app-x86_64
+.else
+EFI_TARGET=	efi-app-ia32
+.endif
+
 loader.efi: loader.sym
 	if [ `${OBJDUMP} -t ${.ALLSRC} | fgrep '*UND*' | wc -l` != 0 ]; then \
 		${OBJDUMP} -t ${.ALLSRC} | fgrep '*UND*'; \
 		exit 1; \
 	fi
-	${OBJCOPY} -j .data -j .dynamic -j .dynstr -j .dynsym -j .hash \
-	    -j .rel.dyn -j .reloc -j .sdata -j .text -j set_Xcommand_set \
-	    --target=efi-app-ia32 ${.ALLSRC} ${.TARGET}
+	${OBJCOPY} -j .text -j .sdata -j .data \
+                -j .dynamic -j .dynsym  -j .rel.dyn \
+                -j .rela.dyn -j .reloc -j .eh_frame \
+	        --target=${EFI_TARGET} ${.ALLSRC} ${.TARGET}
 
 LIBEFI=		${.OBJDIR}/../../efi/libefi/libefi.a
 CFLAGS+=	-I${.CURDIR}/../libi386
@@ -67,10 +82,3 @@ DPADD=		${LIBFICL} ${LIBEFI} ${LIBSTAND}
 LDADD=		${LIBFICL} ${LIBEFI} ${LIBSTAND}
 
 .include <bsd.prog.mk>
-
-.if ${MACHINE_CPUARCH} == "amd64"
-CFLAGS+=        -I.
-beforedepend ${OBJS}: machine
-machine:
-	ln -sf ${.CURDIR}/../../../i386/include machine
-.endif

Added: projects/uefi/sys/boot/i386/efi/amd64/start.S
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/uefi/sys/boot/i386/efi/amd64/start.S	Wed Jan 30 01:05:24 2013	(r246104)
@@ -0,0 +1,72 @@
+/* crt0-efi-x86_64.S - x86_64 EFI startup code.
+   Copyright (C) 1999 Hewlett-Packard Co.
+	Contributed by David Mosberger <davidm@hpl.hp.com>.
+   Copyright (C) 2005 Intel Co.
+	Contributed by Fenghua Yu <fenghua.yu@intel.com>.
+
+    All rights reserved.
+
+    Redistribution and use in source and binary forms, with or without
+    modification, are permitted provided that the following conditions
+    are met:
+
+    * Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+    * Redistributions in binary form must reproduce the above
+      copyright notice, this list of conditions and the following
+      disclaimer in the documentation and/or other materials
+      provided with the distribution.
+    * Neither the name of Hewlett-Packard Co. nor the names of its
+      contributors may be used to endorse or promote products derived
+      from this software without specific prior written permission.
+
+    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+    CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+    INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+    MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+    DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+    BE LIABLE FOR ANYDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+    OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+    PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+    PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+    THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
+    TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
+    THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+    SUCH DAMAGE.
+*/
+	.text
+	.align 4
+
+	.globl _start
+_start:
+	subq $8, %rsp
+	pushq %rcx
+	pushq %rdx
+
+0:
+	lea ImageBase(%rip), %rdi
+	lea _DYNAMIC(%rip), %rsi
+
+	popq %rcx
+	popq %rdx
+	pushq %rcx
+	pushq %rdx
+	call _reloc
+
+	popq %rdi
+	popq %rsi
+
+	call efi_main
+	addq $8, %rsp
+
+.exit:	
+  	ret
+
+ 	// hand-craft a dummy .reloc section so EFI knows it's a relocatable executable:
+ 
+	.data
+	.section .reloc, "a"
+	.long	0
+	.long	10
+	.word	0
+

Added: projects/uefi/sys/boot/i386/efi/i386/start.S
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/uefi/sys/boot/i386/efi/i386/start.S	Wed Jan 30 01:05:24 2013	(r246104)
@@ -0,0 +1,70 @@
+/*-
+ * Copyright (c) 2008-2010 Rui Paulo <rpaulo@FreeBSD.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	$FreeBSD$
+ */
+
+	.text
+
+#include <machine/asm.h>
+
+#define EFI_SUCCESS		0
+
+/*
+ * EFI entry point. 
+ * _start(EFI_IMAGE image_handle, EFI_SYSTEM_TABLE *system_table);
+ *
+ * We calculate the base address along with _DYNAMIC, relocate us and finally
+ * pass control to efi_main.
+ */
+
+ENTRY(_start)
+	pushl	%ebp
+	movl	%esp, %ebp
+
+	pushl	12(%ebp)	/* image_handle */
+	pushl	8(%ebp)		/* system_table */
+	call	0f
+0:	popl	%eax
+	movl	%eax, %ebx
+	addl	$ImageBase-0b, %eax
+	addl	$_DYNAMIC-0b, %ebx
+	pushl	%ebx		/* dynamic */
+	pushl	%eax		/* ImageBase */
+	call	_reloc
+	cmpl	$EFI_SUCCESS, %eax
+	jne	1f
+	popl	%ebx		/* remove ImageBase from the stack */
+	popl	%ebx		/* remove dynamic from the stack */
+	call	efi_main
+1:	leave
+	ret
+END(_start)
+
+	.data
+	.section .reloc, "a"
+	.long	0
+	.long	10
+	.word	0

Modified: projects/uefi/sys/boot/i386/efi/ldscript.amd64
==============================================================================
--- projects/uefi/sys/boot/i386/efi/ldscript.amd64	Wed Jan 30 00:58:10 2013	(r246103)
+++ projects/uefi/sys/boot/i386/efi/ldscript.amd64	Wed Jan 30 01:05:24 2013	(r246104)
@@ -7,11 +7,13 @@ SECTIONS
   /* Read-only sections, merged into text segment: */
   . = 0;
   ImageBase = .;
-  . = SIZEOF_HEADERS;
+  .hash : { *(.hash) }  /* this MUST come first! */
   . = ALIGN(4096);
-  .eh_frame	: {
+  .eh_frame : 
+  { 
     *(.eh_frame)
-   }
+  }
+  . = ALIGN(4096);
   .text		: {
     *(.text .stub .text.* .gnu.linkonce.t.*)
     /* .gnu.warning sections are handled specially by elf32.em. */
@@ -51,24 +53,14 @@ SECTIONS
   .dynamic	: { *(.dynamic) }
   . = ALIGN(4096);
   .rela.dyn	: {
-    *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*)
-    *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*)
-    *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*)
+    *(.rela.data*)
     *(.rela.got)
-    *(.rela.sdata .rela.sdata.* .rela.gnu.linkonce.s.*)
-    *(.rela.sbss .rela.sbss.* .rela.gnu.linkonce.sb.*)
-    *(.rela.sdata2 .rela.sdata2.* .rela.gnu.linkonce.s2.*)
-    *(.rela.sbss2 .rela.sbss2.* .rela.gnu.linkonce.sb2.*)
-    *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*)
-    *(.rela.plt)
+    *(.rela.stab)
     *(.relset_*)
-    *(.rela.dyn .rela.dyn.*)
   }
   . = ALIGN(4096);
   .reloc	: { *(.reloc) }
   . = ALIGN(4096);
-  .hash		: { *(.hash) }
-  . = ALIGN(4096);
   .dynsym	: { *(.dynsym) }
   . = ALIGN(4096);
   .dynstr	: { *(.dynstr) }

Modified: projects/uefi/sys/boot/zfs/Makefile
==============================================================================
--- projects/uefi/sys/boot/zfs/Makefile	Wed Jan 30 00:58:10 2013	(r246103)
+++ projects/uefi/sys/boot/zfs/Makefile	Wed Jan 30 01:05:24 2013	(r246104)
@@ -12,20 +12,22 @@ CFLAGS+=	-I${.CURDIR}/../../cddl/boot/zf
 
 CFLAGS+=	-ffreestanding
 .if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64"
+.if !defined(ZFS64)
 CFLAGS+=	-march=i386
 CFLAGS+=	-mpreferred-stack-boundary=2
+.endif
 CFLAGS+=	-mno-mmx -mno-3dnow -mno-sse -mno-sse2 -mno-sse3 -msoft-float
 .endif
 .if ${MACHINE_CPUARCH} == "powerpc" || ${MACHINE_CPUARCH} == "arm"
 CFLAGS+=	-msoft-float
 .endif
-.if ${MACHINE_CPUARCH} == "amd64"
+.if ${MACHINE_CPUARCH} == "amd64" && !defined(ZFS64)
 CFLAGS+=	-m32
 .endif
 
 CFLAGS+=	-Wformat -Wall
 
-.if ${MACHINE_CPUARCH} == "amd64"
+.if ${MACHINE_CPUARCH} == "amd64" && !defined(ZFS64)
 CLEANFILES+=    machine
 machine:
 	ln -sf ${.CURDIR}/../../i386/include machine
@@ -33,7 +35,7 @@ machine:
 
 .include <bsd.lib.mk>
 
-.if ${MACHINE_CPUARCH} == "amd64"
+.if ${MACHINE_CPUARCH} == "amd64" && !defined(ZFS64)
 .if !exists(machine)
 beforedepend ${OBJS}: machine
 .endif

Added: projects/uefi/sys/boot/zfs64/Makefile
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/uefi/sys/boot/zfs64/Makefile	Wed Jan 30 01:05:24 2013	(r246104)
@@ -0,0 +1,8 @@
+# $FreeBSD$
+
+ZFS64=
+ZFSDIR=	${.CURDIR}/../zfs
+
+.PATH:	${ZFSDIR}
+
+.include "${ZFSDIR}/Makefile"



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201301300105.r0U15PB3024533>