diff mbox

modpost: treat undefined CRC symbols as absent

Message ID 582B3BC5020000780011EF53@prv-mh.provo.novell.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jan Beulich Nov. 15, 2016, 3:45 p.m. UTC
Apparently dependent on binutils version, undefined CRC symbols may or
may not make it into the final binary's symbol table. Treat undefined
ones as absent instead of as having value zero.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
---
I've only noticed this with the recent switch to exporting symbols
defined in assembly files from their source files, as that has caused
a number of such symbols to appear.
---
 scripts/mod/modpost.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)




--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

--- 4.9-rc5/scripts/mod/modpost.c
+++ 4.9-rc5-ignore-undef-CRC/scripts/mod/modpost.c
@@ -617,7 +617,8 @@  static void handle_modversions(struct mo
 		export = export_from_sec(info, get_secindex(info, sym));
 
 	/* CRC'd symbol */
-	if (strncmp(symname, CRC_PFX, strlen(CRC_PFX)) == 0) {
+	if (sym->st_shndx != SHN_UNDEF &&
+	    strncmp(symname, CRC_PFX, strlen(CRC_PFX)) == 0) {
 		crc = (unsigned int) sym->st_value;
 		sym_update_crc(symname + strlen(CRC_PFX), mod, crc,
 				export);