From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1YIlhM-0003XR-7Y for mharc-grub-devel@gnu.org; Tue, 03 Feb 2015 17:11:56 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52894) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YIlhI-0003WK-Un for grub-devel@gnu.org; Tue, 03 Feb 2015 17:11:53 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YIlhH-0002uj-Qu for grub-devel@gnu.org; Tue, 03 Feb 2015 17:11:52 -0500 Received: from mail-wi0-x232.google.com ([2a00:1450:400c:c05::232]:36040) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YIlhH-0002uQ-Gu for grub-devel@gnu.org; Tue, 03 Feb 2015 17:11:51 -0500 Received: by mail-wi0-f178.google.com with SMTP id bs8so24922065wib.5 for ; Tue, 03 Feb 2015 14:11:50 -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:subject:references :in-reply-to:content-type; bh=mR2d6Hf8gCBj/NoSsY8WWrQYxjKz0bLdI5WZ/ZIwVu8=; b=l3ThRo8N4Ac372diMdOe3xw0UWAiBvUpNji9epnziMW2bgAGhdQm0iNtEErzetp5Ng NNEhUaFcTZmJhJswzGhnomWGFfRlgGyiehoVRTUcW6rChXOUJ5Fawmo8PJ6qM9QYae8V ng28H/lJGGqELl9jC/NIJ8HOMvKpUi5tMb4d7pevS6SXbdb1K8HPg9j4PVTu6fZ5Hb4I j7I1gE7A6+tg/ns1mBDrmhgol7o/D3AXMrIRS+bFOzU5ROsR8rdVDxphWzM2nXMmf26a sUJGYP9kgMM/3vPqdJrV4+v+Zku4iB+ea4nCAwrnCwjSC03ZVyxKMiKvNEpDaytPg9Xj BOPw== X-Received: by 10.194.60.104 with SMTP id g8mr1103409wjr.96.1423001505464; Tue, 03 Feb 2015 14:11:45 -0800 (PST) Received: from ?IPv6:2a02:1205:501d:9210:260:c3ff:fed4:2fac? ([2a02:1205:501d:9210:260:c3ff:fed4:2fac]) by mx.google.com with ESMTPSA id k1sm34400649wjn.9.2015.02.03.14.11.44 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 03 Feb 2015 14:11:44 -0800 (PST) Message-ID: <54D147A0.9070405@gmail.com> Date: Tue, 03 Feb 2015 23:11:44 +0100 From: =?UTF-8?B?VmxhZGltaXIgJ8+GLWNvZGVyL3BoY29kZXInIFNlcmJpbmVua28=?= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.4.0 MIME-Version: 1.0 To: The development of GNU GRUB Subject: Re: [PATCH] arm: implement additional relocations generated by gcc 4.9 at -O3 References: <1422999057-24715-1-git-send-email-leif.lindholm@linaro.org> In-Reply-To: <1422999057-24715-1-git-send-email-leif.lindholm@linaro.org> Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="uMec0pKoVkeeBBXvPuM9ahhcs213Outdj" X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:400c:c05::232 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: Tue, 03 Feb 2015 22:11:54 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --uMec0pKoVkeeBBXvPuM9ahhcs213Outdj Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Go ahead On 03.02.2015 22:30, Leif Lindholm wrote: > GCC 4.9 also generates R_ARM_THM_MOVW_ABS_NC and R_ARM_THM_MOVT_ABS, > as an alternative to ABS32. >=20 > Signed-off-by: Leif Lindholm > --- > grub-core/kern/arm/dl.c | 15 +++++++++++++++ > grub-core/kern/arm/dl_helper.c | 39 ++++++++++++++++++++++++++++++++++= +++++ > include/grub/arm/reloc.h | 5 +++++ > 3 files changed, 59 insertions(+) >=20 > diff --git a/grub-core/kern/arm/dl.c b/grub-core/kern/arm/dl.c > index 57cac2e..5cbd65e 100644 > --- a/grub-core/kern/arm/dl.c > +++ b/grub-core/kern/arm/dl.c > @@ -205,6 +205,21 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void= *ehdr, > */ > case R_ARM_V4BX: > break; > + case R_ARM_THM_MOVW_ABS_NC: > + case R_ARM_THM_MOVT_ABS: > + { > + grub_uint32_t offset; > + offset =3D grub_arm_thm_movw_movt_get_value((grub_uint16_t *) tar= get); > + offset +=3D sym_addr; > + > + if (ELF_R_TYPE (rel->r_info) =3D=3D R_ARM_THM_MOVT_ABS) > + offset >>=3D 16; > + else > + offset &=3D 0xffff; > + > + grub_arm_thm_movw_movt_set_value((grub_uint16_t *) target, offset= ); > + } > + break; > case R_ARM_THM_JUMP19: > { > /* Thumb instructions can be 16-bit aligned */ > diff --git a/grub-core/kern/arm/dl_helper.c b/grub-core/kern/arm/dl_hel= per.c > index 5721939..8a72632 100644 > --- a/grub-core/kern/arm/dl_helper.c > +++ b/grub-core/kern/arm/dl_helper.c > @@ -25,6 +25,20 @@ > #include > #include > =20 > +static inline grub_uint32_t > +thumb_get_instruction_word(grub_uint16_t *target) > +{ > + /* Extract instruction word in alignment-safe manner */ > + return grub_le_to_cpu16 ((*target)) << 16 | grub_le_to_cpu16 (*(targ= et + 1)); > +} > + > +static inline void > +thumb_set_instruction_word(grub_uint16_t *target, grub_uint32_t inswor= d) > +{ > + *target =3D grub_cpu_to_le16 (insword >> 16); > + *(target + 1) =3D grub_cpu_to_le16 (insword & 0xffff); > +} > + > /* > * R_ARM_ABS32 > * > @@ -214,3 +228,28 @@ grub_arm_jump24_set_offset (grub_uint32_t *target,= > =20 > *target =3D grub_cpu_to_le32 (insword); > } > + > +grub_uint16_t > +grub_arm_thm_movw_movt_get_value (grub_uint16_t *target) > +{ > + grub_uint32_t insword; > + > + insword =3D thumb_get_instruction_word (target); > + > + return ((insword & 0xf0000) >> 4) | ((insword & 0x04000000) >> 15) |= \ > + ((insword & 0x7000) >> 4) | (insword & 0xff); > +} > + > +void > +grub_arm_thm_movw_movt_set_value (grub_uint16_t *target, grub_uint16_t= value) > +{ > + grub_uint32_t insword; > + > + insword =3D thumb_get_instruction_word (target); > + insword &=3D 0xfbf08f00; > + > + insword |=3D ((value & 0xf000) << 4) | ((value & 0x0800) << 15) | \ > + ((value & 0x0700) << 4) | (value & 0xff); > + > + thumb_set_instruction_word (target, insword); > +} > diff --git a/include/grub/arm/reloc.h b/include/grub/arm/reloc.h > index b938037..ae92e21 100644 > --- a/include/grub/arm/reloc.h > +++ b/include/grub/arm/reloc.h > @@ -43,4 +43,9 @@ void > grub_arm_jump24_set_offset (grub_uint32_t *target, > grub_int32_t offset); > =20 > +grub_uint16_t > +grub_arm_thm_movw_movt_get_value (grub_uint16_t *target); > +void > +grub_arm_thm_movw_movt_set_value (grub_uint16_t *target, grub_uint16_t= value); > + > #endif >=20 --uMec0pKoVkeeBBXvPuM9ahhcs213Outdj 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 iF4EAREKAAYFAlTRR6AACgkQmBXlbbo5nOueHwEApXA/rhD1tk5lkmBIztUxawv0 pZ8uHxXNeiRbYcBK328A/jF3KAkNhcUYV/yp6po22R9BI86X4tft7bpvMAVbTT3b =2G2p -----END PGP SIGNATURE----- --uMec0pKoVkeeBBXvPuM9ahhcs213Outdj--