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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Sep 29, 2021 at 03:00:52PM +1000, Stephen Rothwell wrote:
> 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.


diff --git a/tools/objtool/special.c b/tools/objtool/special.c
index bc925cf19e2d..fa7cff2bfe77 100644
--- a/tools/objtool/special.c
+++ b/tools/objtool/special.c
@@ -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) {




[Index of Archives]     [Linux Kernel]     [Linux USB Development]     [Yosemite News]     [Linux SCSI]

  Powered by Linux