ARM: assembler: use explicit relocation for ADR with a function symbol

Reimplement the 'badr' macro in a way that forces the reference to be
visible to the linker, which will then take care of setting the Thumb
bit if necessary. This is much better than using '+ 1' to set it
unconditionally, given that the Thumb disposition is not a property of
the reference but a property of the symbol. Also, '+ 1' does not do the
right thing in case the Thumb bit is already set.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
diff --git a/arch/arm/include/asm/assembler.h b/arch/arm/include/asm/assembler.h
index 97094aa..295ef6a 100644
--- a/arch/arm/include/asm/assembler.h
+++ b/arch/arm/include/asm/assembler.h
@@ -206,7 +206,9 @@
 	.irp	c,,eq,ne,cs,cc,mi,pl,vs,vc,hi,ls,ge,lt,gt,le,hs,lo
 	.macro	badr\c, rd, sym
 #ifdef CONFIG_THUMB2_KERNEL
-	adr\c	\rd, \sym + 1
+	.type	\sym, %function
+	.reloc	., R_ARM_THM_ALU_PREL_11_0, \sym
+	adr\c	\rd, .
 #else
 	adr\c	\rd, \sym
 #endif