Skip to contentSkip to conversation

Handle non ABS crc symbols

PATCH In review Andi Kleen 3 participants 3 messages Aug 9, 2013 – Aug 14, 2013 Kbuild

lore
Share & tools
lore

Andi Kleen

author
#0 lore raw

PATCH 1/1 Handle non ABS crc symbols

From: Andi Kleen <[email protected]>

For some reason I managed to trick gcc into create CRC symbols that are not absolute anymore, but weak.

Make modpost handle this case.

Andrew, this should fix the bizarre warning. Seems like a toolchain bug to me.

---
 scripts/mod/modpost.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)
scripts/mod/modpost.c +7 -8
index 6216434..b3dd735 100644
@@ -599,18 +599,17 @@ static void handle_modversions(struct module *mod, struct elf_info *info,
 	else
 		export = export_from_sec(info, get_secindex(info, sym));
 
+	/* CRC'd symbol */
+	if (strncmp(symname, CRC_PFX, strlen(CRC_PFX)) == 0) {
+		crc = (unsigned int) sym->st_value;
+		sym_update_crc(symname + strlen(CRC_PFX), mod, crc,
+				export);
+	}
+
 	switch (sym->st_shndx) {
 	case SHN_COMMON:
 		warn("\"%s\" [%s] is COMMON symbol\n", symname, mod->name);
 		break;
-	case SHN_ABS:
-		/* CRC'd symbol */
-		if (strncmp(symname, CRC_PFX, strlen(CRC_PFX)) == 0) {
-			crc = (unsigned int) sym->st_value;
-			sym_update_crc(symname + strlen(CRC_PFX), mod, crc,
-					export);
-		}
-		break;
 	case SHN_UNDEF:
 		/* undefined symbol */
 		if (ELF_ST_BIND(sym->st_info) != STB_GLOBAL &&
Signature · 1 line
1.8.3.1
#1 lore raw

Added Rusty to CC.

Dne 9.8.2013 21:45, Andi Kleen napsal(a):

Quoted 46 lines

From: Andi Kleen <[email protected]>

For some reason I managed to trick gcc into create CRC symbols that are not absolute anymore, but weak.

Make modpost handle this case.

Andrew, this should fix the bizarre warning. Seems like a toolchain bug to me.

---
 scripts/mod/modpost.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)
scripts/mod/modpost.c +7 -8
index 6216434..b3dd735 100644
@@ -599,18 +599,17 @@ static void handle_modversions(struct module *mod, struct elf_info *info,
 	else
 		export = export_from_sec(info, get_secindex(info, sym));
 
+	/* CRC'd symbol */
+	if (strncmp(symname, CRC_PFX, strlen(CRC_PFX)) == 0) {
+		crc = (unsigned int) sym->st_value;
+		sym_update_crc(symname + strlen(CRC_PFX), mod, crc,
+				export);
+	}
+
 	switch (sym->st_shndx) {
 	case SHN_COMMON:
 		warn("\"%s\" [%s] is COMMON symbol\n", symname, mod->name);
 		break;
-	case SHN_ABS:
-		/* CRC'd symbol */
-		if (strncmp(symname, CRC_PFX, strlen(CRC_PFX)) == 0) {
-			crc = (unsigned int) sym->st_value;
-			sym_update_crc(symname + strlen(CRC_PFX), mod, crc,
-					export);
-		}
-		break;
 	case SHN_UNDEF:
 		/* undefined symbol */
 		if (ELF_ST_BIND(sym->st_info) != STB_GLOBAL &&
#2 lore raw
Quoted 14 lines · Michal Marek

Added Rusty to CC.

Dne 9.8.2013 21:45, Andi Kleen napsal(a):

Quoted 11 lines

From: Andi Kleen <[email protected]>

For some reason I managed to trick gcc into create CRC symbols that are not absolute anymore, but weak.

Make modpost handle this case.

Andrew, this should fix the bizarre warning. Seems like a toolchain bug to me.

Do you also end up with relocated CRCs, like ppc does?

See ARCH_RELOCATES_KCRCTAB in kernel/module.c.

Cheers,
Rusty.

Quoted 35 lines
Quoted 35 lines
---
 scripts/mod/modpost.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)
scripts/mod/modpost.c +7 -8
index 6216434..b3dd735 100644
@@ -599,18 +599,17 @@ static void handle_modversions(struct module *mod, struct elf_info *info,
 	else
 		export = export_from_sec(info, get_secindex(info, sym));
 
+	/* CRC'd symbol */
+	if (strncmp(symname, CRC_PFX, strlen(CRC_PFX)) == 0) {
+		crc = (unsigned int) sym->st_value;
+		sym_update_crc(symname + strlen(CRC_PFX), mod, crc,
+				export);
+	}
+
 	switch (sym->st_shndx) {
 	case SHN_COMMON:
 		warn("\"%s\" [%s] is COMMON symbol\n", symname, mod->name);
 		break;
-	case SHN_ABS:
-		/* CRC'd symbol */
-		if (strncmp(symname, CRC_PFX, strlen(CRC_PFX)) == 0) {
-			crc = (unsigned int) sym->st_value;
-			sym_update_crc(symname + strlen(CRC_PFX), mod, crc,
-					export);
-		}
-		break;
 	case SHN_UNDEF:
 		/* undefined symbol */
 		if (ELF_ST_BIND(sym->st_info) != STB_GLOBAL &&