Skip to contentSkip to conversation

linux-next: build warning after merge of the tip tree

DISCUSSION Stephen Rothwell 2 participants 2 messages Sep 29, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi all,

After merging the tip tree, today's linux-next build (x86_64 allmodconfig) produced this warning:

vmlinux.o: warning: objtool: .altinstructions+0x171b4: don't know how to handle non-section reloc symbol do_swap

I don't know where this came from, and it started before today was hidden by other warnings.

Signature · 2 lines
Cheers,
Stephen Rothwell
maintainer
#1 lore raw
Quoted 9 lines · Stephen Rothwell

Hi all,

After merging the tip tree, today's linux-next build (x86_64 allmodconfig) produced this warning:

vmlinux.o: warning: objtool: .altinstructions+0x171b4: don't know how to handle non-section reloc symbol do_swap

I don't know where this came from, and it started before today was hidden by other warnings.

Yeah, it started showing up somewhere recently, I've had it on the todo list and finally got around to looking at it last night. I've got the below before calling it quits for the day.

I'll go see if it still makes sense to me after waking up, and then I'll go write a Changelog.

tools/objtool/special.c +13 -5
index bc925cf19e2d..fa7cff2bfe77 100644
@@ -91,15 +91,23 @@ static int get_alt_entry(struct elf *elf, struct special_entry *entry,
 		WARN_FUNC("can't find orig reloc", sec, offset + entry->orig);
 		return -1;
 	}
-	if (orig_reloc->sym->type != STT_SECTION) {
-		WARN_FUNC("don't know how to handle non-section reloc symbol %s",
+	switch (orig_reloc->sym->type) {
+	case STT_FUNC:
+		alt->orig_sec = orig_reloc->sym->sec;
+		alt->orig_off = orig_reloc->sym->offset + orig_reloc->addend;
+		break;
+
+	case STT_SECTION:
+		alt->orig_sec = orig_reloc->sym->sec;
+		alt->orig_off = orig_reloc->addend;
+		break;
+
+	default:
+		WARN_FUNC("don't know how to handle reloc symbol type: %s",
 			   sec, offset + entry->orig, orig_reloc->sym->name);
 		return -1;
 	}
 
-	alt->orig_sec = orig_reloc->sym->sec;
-	alt->orig_off = orig_reloc->addend;
-
 	if (!entry->group || alt->new_len) {
 		new_reloc = find_reloc_by_dest(elf, sec, offset + entry->new);
 		if (!new_reloc) {