Commit 4baae989 authored by Josh Poimboeuf's avatar Josh Poimboeuf Committed by Peter Zijlstra
Browse files

objtool: Print data address for "!ENDBR" data warnings



When a "!ENDBR" warning is reported for a data section, objtool just
prints the text address of the relocation target twice, without giving
any clues about the location of the original data reference:

  vmlinux.o: warning: objtool: dcbnl_netdevice_event()+0x0: .text+0xb64680: data relocation to !ENDBR: dcbnl_netdevice_event+0x0

Instead, print the address of the data reference, in addition to the
address of the relocation target.

  vmlinux.o: warning: objtool: dcbnl_nb+0x0: .data..read_mostly+0xe260: data relocation to !ENDBR: dcbnl_netdevice_event+0x0

Fixes: 89bc853e ("objtool: Find unused ENDBR instructions")
Signed-off-by: default avatarJosh Poimboeuf <jpoimboe@redhat.com>
Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/762e88d51300e8eaf0f933a5b0feae20ac033bea.1650300597.git.jpoimboe@redhat.com
parent 1ab80a0d
Loading
Loading
Loading
Loading
+2 −5
Original line number Original line Diff line number Diff line
@@ -3817,11 +3817,8 @@ static int validate_ibt(struct objtool_file *file)
			struct instruction *dest;
			struct instruction *dest;


			dest = validate_ibt_reloc(file, reloc);
			dest = validate_ibt_reloc(file, reloc);
			if (is_data && dest && !dest->noendbr) {
			if (is_data && dest && !dest->noendbr)
				warn_noendbr("data ", reloc->sym->sec,
				warn_noendbr("data ", sec, reloc->offset, dest);
					     reloc->sym->offset + reloc->addend,
					     dest);
			}
		}
		}
	}
	}