Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 31 Aug 2008 10:52:12 GMT
From:      Rui Paulo <rpaulo@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 148903 for review
Message-ID:  <200808311052.m7VAqCQZ020501@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=148903

Change 148903 by rpaulo@rpaulo_alpha on 2008/08/31 10:51:32

	The proper return is EFI_STATUS.
	Add the necessary changes for amd64 relocations.

Affected files ...

.. //depot/projects/efi/boot/i386/Makefile.inc#3 edit
.. //depot/projects/efi/boot/i386/efi/Makefile#3 edit
.. //depot/projects/efi/boot/i386/efi/reloc.c#4 edit

Differences ...

==== //depot/projects/efi/boot/i386/Makefile.inc#3 (text+ko) ====

@@ -5,15 +5,16 @@
 BINDIR?=	/boot
 
 LOADER_ADDRESS?=0x200000
-CFLAGS+=	-ffreestanding -mpreferred-stack-boundary=2 \
+# -mpreferred-stack-boundary=2 \
+CFLAGS+=	-ffreestanding -fPIC \
 		-mno-mmx -mno-3dnow -mno-sse -mno-sse2 -mno-sse3
 LDFLAGS+=	-nostdlib
 
-.if ${MACHINE_ARCH} == "amd64"
-CFLAGS+=	-m32 -march=i386
-LDFLAGS+=	-m elf_i386_fbsd
-AFLAGS+=	--32
-.endif
+#.if ${MACHINE_ARCH} == "amd64"
+#CFLAGS+=	-m32 -march=i386
+#LDFLAGS+=	-m elf_i386_fbsd
+#AFLAGS+=	--32
+#.endif
 
 # BTX components
 .if exists(${.OBJDIR}/../btx)

==== //depot/projects/efi/boot/i386/efi/Makefile#3 (text+ko) ====

@@ -2,6 +2,7 @@
 
 NO_MAN=
 WITHOUT_SSP=
+BUILDING_EFI=
 
 .include <bsd.own.mk>
 
@@ -33,14 +34,16 @@
 FILES=	loader.efi
 FILESMODE_loader.efi=	${BINMODE}
 
-LDSCRIPT=	${.CURDIR}/ldscript.ia32
+LDSCRIPT.i386=	${.CURDIR}/ldscript.ia32
+LDSCRIPT.amd64=	${.CURDIR}/ldscript.ia32-64
+LDSCRIPT=	${LDSCRIPT.${MACHINE_ARCH}}
 LDFLAGS=	-Wl,-T${LDSCRIPT} -shared -symbolic
 
 ${PROG}:	${LDSCRIPT}
 
 CLEANFILES=	vers.c loader.efi
 
-NEWVERSWHAT=	"EFI loader" ia32
+NEWVERSWHAT=	"EFI loader" ${MACHINE_ARCH}
 
 vers.c:	${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version
 	sh ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version ${NEWVERSWHAT}

==== //depot/projects/efi/boot/i386/efi/reloc.c#4 (text+ko) ====

@@ -34,7 +34,7 @@
 /*
  * A simple relocator for IA32 EFI binaries.
  */
-int
+EFI_STATUS
 _reloc(unsigned long ImageBase, Elf32_Dyn *dynamic, EFI_HANDLE image_handle,
     EFI_SYSTEM_TABLE *system_table)
 {
@@ -67,7 +67,11 @@
 
 	/*
 	 * Perform the actual relocation.
+	 * XXX: We are reusing code for the amd64 version of this, but
+	 * we must make sure the relocation types are the same.
 	 */
+	CTASSERT(R_386_NONE == R_x86_64_NONE);
+	CTASSERT(R_386_RELATIVE == R_X86_64_RELATIVE);
 	for (; relsz > 0; relsz -= relent) {
 		switch (ELF32_R_TYPE(rel->r_info)) {
 		case R_386_NONE:



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