Skip to contentSkip to conversation

modpost: Support objects with more than 64k sections

PATCH New Denys Vlasenko 1 participant 1 message Jan 15, 2010 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 modpost: Support objects with more than 64k sections

In order to help a bit with future merge of -ffunction-sections work, I am resending a self-contained prerequisiste:
fix for "modpost + more than 64000 sections" situation.

This patch makes modpost able to process object files with more than 64k sections. Needed for huge kernel builds (allyesconfig, for example) with -ffunction-sections.

Rediffed against 2.6.33-rc4-next-20100114, placated checkpatch.pl

scripts/mod/file2alias.c +3 -3
diff -d -urpN linux-2.6.33-rc4-next-20100114.org/scripts/mod/file2alias.c linux-2.6.33-rc4-next-20100114/scripts/mod/file2alias.c
@@ -839,16 +839,16 @@ void handle_moddevtable(struct module *m
 	char *zeros = NULL;
 
 	/* We're looking for a section relative symbol */
-	if (!sym->st_shndx || sym->st_shndx >= info->hdr->e_shnum)
+	if (!sym->st_shndx || get_secindex(info, sym) >= info->num_sections)
 		return;
 
 	/* Handle all-NULL symbols allocated into .bss */
-	if (info->sechdrs[sym->st_shndx].sh_type & SHT_NOBITS) {
+	if (info->sechdrs[get_secindex(info, sym)].sh_type & SHT_NOBITS) {
 		zeros = calloc(1, sym->st_size);
 		symval = zeros;
 	} else {
 		symval = (void *)info->hdr
-			+ info->sechdrs[sym->st_shndx].sh_offset
+			+ info->sechdrs[get_secindex(info, sym)].sh_offset
 			+ sym->st_value;
 	}
 
scripts/mod/modpost.c +68 -26

199 lines not on this page · raw message

scripts/mod/modpost.h +43 -0

51 lines not on this page · raw message