Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753280AbcLCEhA (ORCPT ); Fri, 2 Dec 2016 23:37:00 -0500 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:48775 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752060AbcLCEg6 (ORCPT ); Fri, 2 Dec 2016 23:36:58 -0500 Message-ID: <1480739797.16599.118.camel@decadent.org.uk> Subject: Re: [RFC, PATCH, v3.9] default exported asm symbols to zero From: Ben Hutchings To: Arnd Bergmann , Linus Torvalds Cc: Adam Borowski , Greg Kroah-Hartman , Linux Kbuild mailing list , Michal Marek , Debian kernel maintainers , "linux-arch@vger.kernel.org" , Ingo Molnar , Nicholas Piggin , Linux Kernel Mailing List , Alan Modra Date: Sat, 03 Dec 2016 04:36:37 +0000 In-Reply-To: <8452191.39CeLIHTBT@wuerfel> References: <20161129131922.GA31466@angband.pl> <14455987.OWjnZpEEup@wuerfel> <8452191.39CeLIHTBT@wuerfel> Content-Type: multipart/signed; micalg="pgp-sha512"; protocol="application/pgp-signature"; boundary="=-jgxpGrB4le5YdtYZKT0O" X-Mailer: Evolution 3.22.2-1 Mime-Version: 1.0 X-SA-Exim-Connect-IP: 2a02:8011:400e:2:6f00:88c8:c921:d332 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2942 Lines: 74 --=-jgxpGrB4le5YdtYZKT0O Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, 2016-12-02 at 13:40 +0100, Arnd Bergmann wrote: > With binutils-2.16 and before, a weak missing symbol was kept during the > final link, and a missing CRC for an export would lead to that CRC > being treated as zero implicitly. With binutils-2.17, the crc > symbol gets dropped, and any module trying to use it will fail to > load. >=20 > This sets the weak CRC symbol to zero explicitly, making it defined > in vmlinux, which in turn lets us load the modules referring to > that CRC. >=20 > The comment above the __CRC_SYMBOL macro suggests that this was > always the intention, although it also seems that all symbols > defined in C have a correct CRC these days, and only the exports > that are now done in assembly need this. >=20 > > Signed-off-by: Arnd Bergmann > --- > Not sure if this is the correct way of doing it, but this seems trivial > enough and lets me build the kernel with missing CRCs with any binutils > version. I tried this along with Adam's patch on x86_64, with Debian's binutils 2.27.51.20161127. The result was that the kernel's __kcrctab held 0 for several symbols, even though there was type information in asm- prototypes.h and Module.symvers and the modules had a non-zero CRC for those symbols. With just Adam's patch, the kernel and modules agreed. Ben. > diff --git a/include/asm-generic/export.h b/include/asm-generic/export.h > index 63554e9..59a3b2f 100644 > --- a/include/asm-generic/export.h > +++ b/include/asm-generic/export.h > @@ -54,6 +54,7 @@ KSYM(__kstrtab_\name): > =C2=A0KSYM(__kcrctab_\name): > > =C2=A0 __put KSYM(__crc_\name) > > =C2=A0 .weak KSYM(__crc_\name) > > + .set KSYM(__crc_\name), 0 > > =C2=A0 .previous > =C2=A0#endif > =C2=A0#endif >=20 --=20 Ben Hutchings Absolutum obsoletum. (If it works, it's out of date.) - Stafford Beer --=-jgxpGrB4le5YdtYZKT0O Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEErCspvTSmr92z9o8157/I7JWGEQkFAlhCS9UACgkQ57/I7JWG EQn/LA/9Gu6KIOp7WrTbarspgkEtwgTK02mqCOZdtzDpZL1allV3IjjPEt1sXWgV ko9iYxSVwBD4WkE5GgBjpsbzaLA8xrHKOMFut4bJheCGXRx8TkFyiaA+EainToZL dGB0OFRm6XIMdQsJ26h506HHdQzqb5eqTTRjK+OQXTFsY+hXLQjfQbvaeQsE1xo6 Wf7ebEfWnZUD78i2UYH66rgVjErGRWNN6wwbV6fxhNlvDGiYiE8GVVV+VyjRIcV1 XelpnQ20CjQNzshYbFk4AuiTwquMsuvpWUBAZmmUdtuBzIHQH1OVuw6mycdJLYKQ /VpyYJRqoussdtPoPeS7tct+/OlgmffX8wdd1uSPXg9yYMz4JSl3jTJFlhqKVVwW phLHW4dNHpQjXmLnbWJ5nXhdX7d4ODWOycNB5efIQSz8XT0SfBcgZfFP9e+YAAm+ VMEOl3Lgs1881fVjhKeapFJD5ggA1ZmEoHEKif6aotSyLjvzGxSI6Hmg3oblXrAQ jOQseYNiOS7vDxydePF9dS00wv5GS1XA/q3Aomfen4mmOI4/lyXpYyhQPxQyradb W8o+q/TgYBb6TS0UjAl3ooFNQkFu23lQo/f3zBbB2/pcIRi7Ec8CNltYsPwyQJet nPySQDk45Vm8JjrnAL2v6NEXlnZvHtLAJptwkBLOq7IkIOgPoi8= =6jbi -----END PGP SIGNATURE----- --=-jgxpGrB4le5YdtYZKT0O--