From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933440AbcBCMtp (ORCPT ); Wed, 3 Feb 2016 07:49:45 -0500 Received: from mailapp01.imgtec.com ([195.59.15.196]:35500 "EHLO imgpgp01.kl.imgtec.org" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932638AbcBCMtm (ORCPT ); Wed, 3 Feb 2016 07:49:42 -0500 X-PGP-Universal: processed; by imgpgp01.kl.imgtec.org on Wed, 03 Feb 2016 12:49:40 +0000 Date: Wed, 3 Feb 2016 12:49:40 +0000 From: James Hogan To: Paul Burton CC: , Ralf Baechle , "Andrey Konovalov" , Andrey Ryabinin , , Andrew Morton Subject: Re: [PATCH 4/5] MIPS: Support R_MIPS_PC16 rel-style reloc Message-ID: <20160203124940.GE5464@jhogan-linux.le.imgtec.org> References: <1454471085-20963-1-git-send-email-paul.burton@imgtec.com> <1454471085-20963-5-git-send-email-paul.burton@imgtec.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="idY8LE8SD6/8DnRI" Content-Disposition: inline In-Reply-To: <1454471085-20963-5-git-send-email-paul.burton@imgtec.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-Originating-IP: [192.168.154.110] X-ESG-ENCRYPT-TAG: 56f439c Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --idY8LE8SD6/8DnRI Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Feb 03, 2016 at 03:44:44AM +0000, Paul Burton wrote: > MIPS32 code uses rel-style relocs, and MIPS32r6 modules may include the > R_MIPS_PC16 relocation. We thus need to support R_MIPS_PC16 rel-style > relocations in order to load MIPS32r6 kernel modules. This patch adds > such support, which is similar to the rela-style R_MIPS_PC16 support but > making use of the implicit addend from the instruction encoding. >=20 > Signed-off-by: Paul Burton > --- >=20 > arch/mips/kernel/module.c | 14 +++++++++++++- > 1 file changed, 13 insertions(+), 1 deletion(-) >=20 > diff --git a/arch/mips/kernel/module.c b/arch/mips/kernel/module.c > index 2adf572..f2de9b8 100644 > --- a/arch/mips/kernel/module.c > +++ b/arch/mips/kernel/module.c > @@ -183,13 +183,25 @@ out_danger: > return -ENOEXEC; > } > =20 > +static int apply_r_mips_pc16_rel(struct module *me, u32 *location, Elf_A= ddr v) > +{ > + u16 val; > + > + val =3D *location; > + val +=3D (v - (Elf_Addr)location) >> 2; > + *location =3D (*location & 0xffff0000) | val; Looks correct, but presumably this could benefit from some sanity checking like the other patches. Cheers James > + > + return 0; > +} > + > static int (*reloc_handlers_rel[]) (struct module *me, u32 *location, > Elf_Addr v) =3D { > [R_MIPS_NONE] =3D apply_r_mips_none, > [R_MIPS_32] =3D apply_r_mips_32_rel, > [R_MIPS_26] =3D apply_r_mips_26_rel, > [R_MIPS_HI16] =3D apply_r_mips_hi16_rel, > - [R_MIPS_LO16] =3D apply_r_mips_lo16_rel > + [R_MIPS_LO16] =3D apply_r_mips_lo16_rel, > + [R_MIPS_PC16] =3D apply_r_mips_pc16_rel, > }; > =20 > int apply_relocate(Elf_Shdr *sechdrs, const char *strtab, > --=20 > 2.7.0 >=20 >=20 --idY8LE8SD6/8DnRI Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJWsfdkAAoJEGwLaZPeOHZ6hWwP/RGhH1om3OSI5yKUjfOy4y0f n0cM78Olx5AS0uPJdQxbMmbbOd1yNzL9GbpjaTqxATR8UOpUecVqdxIxeZP470sU zl/EMqh0+1GuXiH9UTjGSz7U6W2VVRYvfG04SYvmuRl7cT3fx9efF9vSM0Bz/OXR 3SkRBrRU0FLWrL5WBtu/RKF9X9ymuGGiDR3016KIE1WEJzzHu+MawlFnw3XHWoVN oYEQigGz8FQd9ITcQNmEQlyCXPgEKznNVbAE9EemwrSIab+fmWUC2859x7CReJhc UjgyXAwFWQSTSNUDNI92KWIyRK8V61amZ0amj13JklFS3c2jLICLKPF2JaquRrx7 QLw8MqYG0jwthXzTirFtwcudXyfJqjg92tg/P1N6PziYwFt1FYq16Xtjk+AEWE7N HL6Db+bacDmPVh5PJBQWSU8jTdlHI0g7b9/VTJM9GVid0DT2UGi5kcjnl1jDjRaX 4WBb42keTR/W/gwdhBp7cwdOhdYsHNEThYb4bmWa1Wff45RLv+vWPBIvGge8sRkl FyrY6Jnzk7ukNrls9FSYrOzRapeTAya6pY8Q+H0y3Oda8R2WTMMY9fWGDn0C4/pY LmS7Nk6bGFqwGyR0JdiWMNNTq1s/cooiyqTY3bsab7cvSu8peQ2vEJz1aLuU+dEk hSlGdpvzhBBrSrvRd5ZM =JPNz -----END PGP SIGNATURE----- --idY8LE8SD6/8DnRI--