From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1VjlOg-0003G5-Om for mharc-grub-devel@gnu.org; Fri, 22 Nov 2013 02:43:26 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58420) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VjlOZ-0003Ey-K2 for grub-devel@gnu.org; Fri, 22 Nov 2013 02:43:25 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VjlOU-0001W8-4M for grub-devel@gnu.org; Fri, 22 Nov 2013 02:43:19 -0500 Received: from mail-ea0-x22f.google.com ([2a00:1450:4013:c01::22f]:55369) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VjlOT-0001W3-PU for grub-devel@gnu.org; Fri, 22 Nov 2013 02:43:14 -0500 Received: by mail-ea0-f175.google.com with SMTP id z10so317420ead.20 for ; Thu, 21 Nov 2013 23:43:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type; bh=b4zVISKBUMf0YdXjDcMRDnRAj1AUqzqhS/5xLpCkiAU=; b=0D3K4nP4ExD92VUwSJmOR/7zyyOlovrWRdcW4qhgVqfHDYJ5r8UQAvlwjgkHah0YRp UDwcGxKOOO1OhW5yKVldOP5uFt1g8o5JpVo2QNREZ7zq6zH4qfubtOqvQdMeTGNB/BUN yUeLZZjvEcOhewU5LcXp867s3phmEx6urhdFVyZCNjEowvl22oUhw8kjaXBkhYkkIfwo SwN/ywg+zIFILoXP6My89WBVn+2f9kFxmiF9ID7mF3k27Bk+rHYUAXBwS19M7sQAqVPq HjtbuN5COcIe9lK0B6s32W/BkOq4miP+DjbMJbEpimbbmMgaKuoTjmsIQKB8ZdgjNRYg MzpQ== X-Received: by 10.14.8.136 with SMTP id 8mr7008068eer.25.1385106192707; Thu, 21 Nov 2013 23:43:12 -0800 (PST) Received: from [192.168.1.121] (31-249.1-85.cust.bluewin.ch. [85.1.249.31]) by mx.google.com with ESMTPSA id z1sm76299135eeo.14.2013.11.21.23.42.57 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 21 Nov 2013 23:43:12 -0800 (PST) Message-ID: <528F0B00.60007@gmail.com> Date: Fri, 22 Nov 2013 08:42:56 +0100 From: =?UTF-8?B?VmxhZGltaXIgJ8+GLWNvZGVyL3BoY29kZXInIFNlcmJpbmVua28=?= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20131005 Icedove/17.0.9 MIME-Version: 1.0 To: jackie.huang@windriver.com Subject: Re: [PATCH 2/2] grub-efi: allow compilation without large model support References: In-Reply-To: X-Enigmail-Version: 1.5.1 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="----enig2GBEPPTMRJGSDWKPWONBD" X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:4013:c01::22f Cc: The development of GRUB 2 , dvhart@linux.intel.com, openembedded-core@lists.openembedded.org X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Nov 2013 07:43:25 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) ------enig2GBEPPTMRJGSDWKPWONBD Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 22.11.2013 08:23, jackie.huang@windriver.com wrote: > From: Jackie Huang >=20 > -mcmodel=3Dlarge is not supported by gcc with version lower > than 4.4, but we don't need to use memory over 4GiB, so add > a patch to allow compilation without large model support. >=20 This patch is wrong and would reintroduce a bug. Removing AC_MSG_ERROR is all that's needed from this patch. But on the other hand dl.c needs safeguards to prevent silent overflow. > Signed-off-by: Jackie Huang > --- > ...allow-a-compilation-without-mcmodel-large.patch | 81 ++++++++++++++= ++++++++ > meta/recipes-bsp/grub/grub-efi_2.00.bb | 1 + > 2 files changed, 82 insertions(+) > create mode 100644 meta/recipes-bsp/grub/files/grub-efi-allow-a-compil= ation-without-mcmodel-large.patch >=20 > diff --git a/meta/recipes-bsp/grub/files/grub-efi-allow-a-compilation-w= ithout-mcmodel-large.patch b/meta/recipes-bsp/grub/files/grub-efi-allow-a= -compilation-without-mcmodel-large.patch > new file mode 100644 > index 0000000..c6a30c8 > --- /dev/null > +++ b/meta/recipes-bsp/grub/files/grub-efi-allow-a-compilation-without-= mcmodel-large.patch > @@ -0,0 +1,81 @@ > +From 0cea0e4266214da1f11e812834f5d5c47a6e04e6 Mon Sep 17 00:00:00 2001= > +From: Jackie Huang > +Date: Tue, 5 Nov 2013 07:23:32 -0500 > +Subject: [PATCH] Allow a compilation without -mcmodel=3Dlarge > + > +* kern/efi/mm.c (grub_efi_allocate_pages): don't allocate >4GiB > + when compiled without -mcmodel=3Dlarge > + (filter_memory_map): remove memory post 4 GiB when compiled > + without -mcmodel=3Dlarge > +* configure.ac: add -DMCMODEL_SMALL=3D1 to TARGET_CFLAGS when > + -mcmodel=3Dlarge isn't supported > + > +It's ported from old version of grub which was deliberately > +removed in current and newer version: > + > +2009-06-04 Vladimir Serbinenko > + > + Allow a compilation without -mcmodel=3Dlarge > + > +2010-04-21 Vladimir Serbinenko > + > + * configure.ac: Refuse to compile for x86_64-efi is mcmodel=3Dlarge= > + is not supported. > + > +Upstream-Status: Inappropriate [compatibility] > + > +Signed-off-by: Jackie Huang > +--- > + configure.ac | 4 +++- > + grub-core/kern/efi/mm.c | 6 +++--- > + 2 files changed, 6 insertions(+), 4 deletions(-) > + > +diff --git a/configure.ac b/configure.ac > +index 319d063..ee72fee 100644 > +--- a/configure.ac > ++++ b/configure.ac > +@@ -567,7 +567,9 @@ if test "$target_cpu"-"$platform" =3D x86_64-efi; = then > + [grub_cv_cc_mcmodel=3Dno]) > + ]) > + if test "x$grub_cv_cc_mcmodel" =3D xno; then > +- AC_MSG_ERROR([-mcmodel=3Dlarge not supported. Upgrade your gcc.])= > ++ CFLAGS=3D"$SAVED_CFLAGS -m64 -DMCMODEL_SMALL=3D1" > ++ TARGET_CFLAGS=3D"$TARGET_CFLAGS -DMCMODEL_SMALL=3D1" > ++ AC_MSG_WARN([-mcmodel=3Dlarge not supported. You won't be able to= use the memory over 4GiB. Upgrade your gcc.]) > + else > + TARGET_CFLAGS=3D"$TARGET_CFLAGS -mcmodel=3Dlarge" > + fi > +diff --git a/grub-core/kern/efi/mm.c b/grub-core/kern/efi/mm.c > +index a2edc84..c67dd13 100644 > +--- a/grub-core/kern/efi/mm.c > ++++ b/grub-core/kern/efi/mm.c > +@@ -62,7 +62,7 @@ grub_efi_allocate_pages (grub_efi_physical_address_t= address, > + return 0; > + #endif > + > +-#if 1 > ++#if defined (MCMODEL_SMALL) > + if (address =3D=3D 0) > + { > + type =3D GRUB_EFI_ALLOCATE_MAX_ADDRESS; > +@@ -305,7 +305,7 @@ filter_memory_map (grub_efi_memory_descriptor_t *m= emory_map, > + desc =3D NEXT_MEMORY_DESCRIPTOR (desc, desc_size)) > + { > + if (desc->type =3D=3D GRUB_EFI_CONVENTIONAL_MEMORY > +-#if 1 > ++#if defined (MCMODEL_SMALL) > + && desc->physical_start <=3D 0xffffffff > + #endif > + && desc->physical_start + PAGES_TO_BYTES (desc->num_pages) > 0x100= 000 > +@@ -321,7 +321,7 @@ filter_memory_map (grub_efi_memory_descriptor_t *m= emory_map, > + desc->physical_start =3D 0x100000; > + } > + > +-#if 1 > ++#if defined (MCMODEL_SMALL) > + if (BYTES_TO_PAGES (filtered_desc->physical_start) > + + filtered_desc->num_pages > + > BYTES_TO_PAGES (0x100000000LL)) > +-- > +1.7.1 > + > diff --git a/meta/recipes-bsp/grub/grub-efi_2.00.bb b/meta/recipes-bsp/= grub/grub-efi_2.00.bb > index 2fe688c..deb9514 100644 > --- a/meta/recipes-bsp/grub/grub-efi_2.00.bb > +++ b/meta/recipes-bsp/grub/grub-efi_2.00.bb > @@ -27,6 +27,7 @@ SRC_URI =3D "ftp://ftp.gnu.org/gnu/grub/grub-${PV}.ta= r.gz \ > file://grub-no-unused-result.patch \ > file://grub-2.00-ignore-gnulib-gets-stupidity.patch \ > file://fix-issue-with-flex-2.5.37.patch \ > + file://grub-efi-allow-a-compilation-without-mcmodel-large.p= atch \ > " > SRC_URI[md5sum] =3D "e927540b6eda8b024fb0391eeaa4091c" > SRC_URI[sha256sum] =3D "65b39a0558f8c802209c574f4d02ca263a804e8a564bc6= caf1cd0fd3b3cc11e3" >=20 ------enig2GBEPPTMRJGSDWKPWONBD Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.15 (GNU/Linux) Comment: Using GnuPG with Icedove - http://www.enigmail.net/ iF4EAREKAAYFAlKPCwAACgkQmBXlbbo5nOsbvwEAmvIi0chaOyHYPueFa5i5ybWA gA2ORtZOr0c01FcecQ0A/A3yhkVs5iPFJcyWaPd++YJZFA5j3WIjEuNons0mD2UK =Rsdt -----END PGP SIGNATURE----- ------enig2GBEPPTMRJGSDWKPWONBD--