Commit cd063c8b authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'objtool-core-2023-10-28' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull objtool updates from Ingo Molnar:
 "Misc fixes and cleanups:

   - Fix potential MAX_NAME_LEN limit related build failures

   - Fix scripts/faddr2line symbol filtering bug

   - Fix scripts/faddr2line on LLVM=1

   - Fix scripts/faddr2line to accept readelf output with mapping
     symbols

   - Minor cleanups"

* tag 'objtool-core-2023-10-28' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  scripts/faddr2line: Skip over mapping symbols in output from readelf
  scripts/faddr2line: Use LLVM addr2line and readelf if LLVM=1
  scripts/faddr2line: Don't filter out non-function symbols from readelf
  objtool: Remove max symbol name length limitation
  objtool: Propagate early errors
  objtool: Use 'the fallthrough' pseudo-keyword
  x86/speculation, objtool: Use absolute relocations for annotations
  x86/unwind/orc: Remove redundant initialization of 'mid' pointer in __orc_find()
parents 63ce50ff 60fd39af
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -58,7 +58,7 @@
#define ANNOTATE_IGNORE_ALTERNATIVE				\
	"999:\n\t"						\
	".pushsection .discard.ignore_alts\n\t"			\
	".long 999b - .\n\t"					\
	".long 999b\n\t"					\
	".popsection\n\t"

/*
@@ -352,7 +352,7 @@ static inline int alternatives_text_reserved(void *start, void *end)
.macro ANNOTATE_IGNORE_ALTERNATIVE
	.Lannotate_\@:
	.pushsection .discard.ignore_alts
	.long .Lannotate_\@ - .
	.long .Lannotate_\@
	.popsection
.endm

+2 −2
Original line number Diff line number Diff line
@@ -196,7 +196,7 @@
.macro ANNOTATE_RETPOLINE_SAFE
.Lhere_\@:
	.pushsection .discard.retpoline_safe
	.long .Lhere_\@ - .
	.long .Lhere_\@
	.popsection
.endm

@@ -320,7 +320,7 @@
#define ANNOTATE_RETPOLINE_SAFE					\
	"999:\n\t"						\
	".pushsection .discard.retpoline_safe\n\t"		\
	".long 999b - .\n\t"					\
	".long 999b\n\t"					\
	".popsection\n\t"

typedef u8 retpoline_thunk_t[RETPOLINE_THUNK_SIZE];
+1 −1
Original line number Diff line number Diff line
@@ -85,7 +85,7 @@ static struct orc_entry *__orc_find(int *ip_table, struct orc_entry *u_table,
{
	int *first = ip_table;
	int *last = ip_table + num_entries - 1;
	int *mid = first, *found = first;
	int *mid, *found = first;

	if (!num_entries)
		return NULL;
+5 −5
Original line number Diff line number Diff line
@@ -48,13 +48,13 @@
#define ANNOTATE_NOENDBR					\
	"986: \n\t"						\
	".pushsection .discard.noendbr\n\t"			\
	".long 986b - .\n\t"					\
	".long 986b\n\t"					\
	".popsection\n\t"

#define ASM_REACHABLE							\
	"998:\n\t"							\
	".pushsection .discard.reachable\n\t"				\
	".long 998b - .\n\t"						\
	".long 998b\n\t"						\
	".popsection\n\t"

#else /* __ASSEMBLY__ */
@@ -66,7 +66,7 @@
#define ANNOTATE_INTRA_FUNCTION_CALL				\
	999:							\
	.pushsection .discard.intra_function_calls;		\
	.long 999b - .;						\
	.long 999b;						\
	.popsection;

/*
@@ -118,7 +118,7 @@
.macro ANNOTATE_NOENDBR
.Lhere_\@:
	.pushsection .discard.noendbr
	.long	.Lhere_\@ - .
	.long	.Lhere_\@
	.popsection
.endm

@@ -142,7 +142,7 @@
.macro REACHABLE
.Lhere_\@:
	.pushsection .discard.reachable
	.long	.Lhere_\@ - .
	.long	.Lhere_\@
	.popsection
.endm

+21 −3
Original line number Diff line number Diff line
@@ -58,8 +58,21 @@ die() {
	exit 1
}

READELF="${CROSS_COMPILE:-}readelf"
ADDR2LINE="${CROSS_COMPILE:-}addr2line"
UTIL_SUFFIX=""
if [[ "${LLVM:-}" == "" ]]; then
	UTIL_PREFIX=${CROSS_COMPILE:-}
else
	UTIL_PREFIX=llvm-

	if [[ "${LLVM}" == *"/" ]]; then
		UTIL_PREFIX=${LLVM}${UTIL_PREFIX}
	elif [[ "${LLVM}" == "-"* ]]; then
		UTIL_SUFFIX=${LLVM}
	fi
fi

READELF="${UTIL_PREFIX}readelf${UTIL_SUFFIX}"
ADDR2LINE="${UTIL_PREFIX}addr2line${UTIL_SUFFIX}"
AWK="awk"
GREP="grep"

@@ -166,6 +179,11 @@ __faddr2line() {
			local cur_sym_elf_size=${fields[2]}
			local cur_sym_name=${fields[7]:-}

			# is_mapping_symbol(cur_sym_name)
			if [[ ${cur_sym_name} =~ ^(\.L|L0|\$) ]]; then
				continue
			fi

			if [[ $cur_sym_addr = $sym_addr ]] &&
			   [[ $cur_sym_elf_size = $sym_elf_size ]] &&
			   [[ $cur_sym_name = $sym_name ]]; then
@@ -260,7 +278,7 @@ __faddr2line() {

		DONE=1

	done < <(${READELF} --symbols --wide $objfile | sed 's/\[.*\]//' | ${AWK} -v fn=$sym_name '$4 == "FUNC" && $8 == fn')
	done < <(${READELF} --symbols --wide $objfile | sed 's/\[.*\]//' | ${AWK} -v fn=$sym_name '$8 == fn')
}

[[ $# -lt 2 ]] && usage
Loading