tools/objtool/include/objtool/warn.h

Source file repositories/reference/linux-study-clean/tools/objtool/include/objtool/warn.h

File Facts

System
Linux kernel
Corpus path
tools/objtool/include/objtool/warn.h
Extension
.h
Size
5000 bytes
Lines
169
Domain
Support Tooling And Documentation
Bucket
tools
Inferred role
Support Tooling And Documentation: implementation source
Status
source implementation candidate

Why This File Exists

Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.

Dependency Surface

Detected Declarations

Annotated Snippet

static inline void unindent(int *unused) { indent--; }

/*
 * Clang prior to 17 is being silly and considers many __cleanup() variables
 * as unused (because they are, their sole purpose is to go out of scope).
 *
 * https://github.com/llvm/llvm-project/commit/877210faa447f4cc7db87812f8ed80e398fedd61
 */
#undef __cleanup
#define __cleanup(func) __maybe_unused __attribute__((__cleanup__(func)))

#define __dbg(format, ...)						\
	fprintf(stderr,							\
		"DEBUG: %s%s" format "\n",				\
		objname ?: "",						\
		objname ? ": " : "",					\
		##__VA_ARGS__)

#define dbg_checksum_insn(func, insn, checksum)				\
({									\
	if (unlikely(func->debug_checksum)) {				\
		char *insn_off = offstr(insn->sec, insn->offset);	\
		__dbg("checksum: %s(): %s %016llx",			\
		      func->name, insn_off, (unsigned long long)checksum);\
		free(insn_off);						\
	}								\
})

#define dbg_checksum_object(sym, offset, what, checksum)		\
({									\
	if (unlikely(sym->debug_checksum))				\
		__dbg("checksum: %s+0x%lx: %s %016llx",			\
		      sym->name, offset, what,				\
		      (unsigned long long)checksum);			\
})

#define dbg_correlate(args...)						\
({									\
	if (unlikely(debug_correlate))					\
		__dbg(args);						\
})

#define __dbg_clone(format, ...)					\
({									\
	if (unlikely(debug_clone))					\
		__dbg("%*s" format, indent * 8, "", ##__VA_ARGS__);	\
})

#define dbg_clone(args...)						\
	int __cleanup(unindent) __dummy_##__COUNTER__;			\
	__dbg_clone(args);						\
	indent++

#endif /* _WARN_H */

Annotation

Implementation Notes